primer_view_components 0.0.120 → 0.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -0
- data/app/components/primer/alpha/segmented_control/item.rb +1 -0
- data/app/components/primer/alpha/segmented_control.rb +30 -0
- data/app/components/primer/alpha/text_field.rb +1 -0
- data/app/components/primer/base_component.rb +3 -3
- data/app/components/primer/beta/close_button.rb +1 -1
- data/app/components/primer/{local_time.d.ts → beta/relative_time.d.ts} +0 -0
- data/app/components/primer/{local_time.js → beta/relative_time.js} +0 -0
- data/app/components/primer/{local_time.ts → beta/relative_time.ts} +0 -0
- data/app/components/primer/component.rb +2 -1
- data/app/components/primer/primer.d.ts +1 -2
- data/app/components/primer/primer.js +1 -2
- data/app/components/primer/primer.ts +1 -2
- data/app/forms/example_toggle_switch_form.rb +1 -1
- data/app/lib/primer/view_helper.rb +0 -1
- data/lib/primer/deprecations.yml +0 -78
- data/lib/primer/forms/acts_as_component.rb +12 -1
- data/lib/primer/forms/toggle_switch_form.rb +10 -3
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/primer/yard/component_manifest.rb +0 -2
- data/lib/tasks/static.rake +22 -0
- data/previews/primer/alpha/auto_complete_preview.rb +6 -6
- data/previews/primer/alpha/segmented_control_preview/with_label_and_caption.html.erb +9 -0
- data/previews/primer/alpha/segmented_control_preview/with_subhead_actions.html.erb +11 -0
- data/previews/primer/alpha/segmented_control_preview.rb +7 -1
- data/previews/primer/alpha/text_field_preview.rb +14 -0
- data/previews/primer/alpha/toggle_switch_preview.rb +9 -9
- data/previews/primer/beta/auto_complete_preview.rb +17 -17
- data/previews/primer/url_helpers.rb +1 -1
- data/static/arguments.json +6 -100
- data/static/audited_at.json +2 -21
- data/static/constants.json +0 -51
- data/static/previews.json +1634 -0
- data/static/statuses.json +0 -19
- metadata +8 -27
- data/app/components/primer/dropdown/menu.rb +0 -14
- data/app/components/primer/dropdown.rb +0 -7
- data/app/components/primer/hellip_button.rb +0 -7
- data/app/components/primer/label_component.rb +0 -7
- data/app/components/primer/link_component.rb +0 -7
- data/app/components/primer/local_time.rb +0 -63
- data/app/components/primer/markdown.rb +0 -7
- data/app/components/primer/menu_component.rb +0 -7
- data/app/components/primer/octicon_component.rb +0 -7
- data/app/components/primer/octicon_symbols_component.rb +0 -7
- data/app/components/primer/popover_component.rb +0 -8
- data/app/components/primer/spinner_component.rb +0 -7
- data/app/components/primer/state_component.rb +0 -7
- data/app/components/primer/subhead_component.rb +0 -7
- data/app/components/primer/tab_container_component.rb +0 -7
- data/app/components/primer/time_ago_component.d.ts +0 -1
- data/app/components/primer/time_ago_component.js +0 -1
- data/app/components/primer/time_ago_component.rb +0 -51
- data/app/components/primer/time_ago_component.ts +0 -1
- data/app/components/primer/timeline_item_component.rb +0 -13
- data/previews/primer/local_time_component_preview.rb +0 -57
- data/previews/primer/time_ago_component_preview.rb +0 -27
data/static/statuses.json
CHANGED
|
@@ -76,28 +76,9 @@
|
|
|
76
76
|
"Primer::ButtonComponent": "deprecated",
|
|
77
77
|
"Primer::ConditionalWrapper": "alpha",
|
|
78
78
|
"Primer::Content": "stable",
|
|
79
|
-
"Primer::Dropdown": "deprecated",
|
|
80
|
-
"Primer::Dropdown::Menu": "deprecated",
|
|
81
|
-
"Primer::Dropdown::Menu::Item": "deprecated",
|
|
82
|
-
"Primer::HellipButton": "deprecated",
|
|
83
79
|
"Primer::IconButton": "deprecated",
|
|
84
|
-
"Primer::LabelComponent": "deprecated",
|
|
85
80
|
"Primer::LayoutComponent": "alpha",
|
|
86
|
-
"Primer::LinkComponent": "deprecated",
|
|
87
|
-
"Primer::LocalTime": "deprecated",
|
|
88
|
-
"Primer::Markdown": "deprecated",
|
|
89
|
-
"Primer::MenuComponent": "deprecated",
|
|
90
81
|
"Primer::Navigation::TabComponent": "alpha",
|
|
91
|
-
"Primer::OcticonComponent": "deprecated",
|
|
92
|
-
"Primer::OcticonSymbolsComponent": "deprecated",
|
|
93
|
-
"Primer::PopoverComponent": "deprecated",
|
|
94
|
-
"Primer::SpinnerComponent": "deprecated",
|
|
95
|
-
"Primer::StateComponent": "deprecated",
|
|
96
|
-
"Primer::SubheadComponent": "deprecated",
|
|
97
|
-
"Primer::TabContainerComponent": "deprecated",
|
|
98
|
-
"Primer::TimeAgoComponent": "deprecated",
|
|
99
|
-
"Primer::TimelineItemComponent": "deprecated",
|
|
100
|
-
"Primer::TimelineItemComponent::BadgeComponent": "deprecated",
|
|
101
82
|
"Primer::Tooltip": "deprecated",
|
|
102
83
|
"Primer::Truncate": "beta"
|
|
103
84
|
}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: primer_view_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.121
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GitHub Open Source
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-02-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionview
|
|
@@ -628,7 +628,10 @@ files:
|
|
|
628
628
|
- app/components/primer/beta/progress_bar.html.erb
|
|
629
629
|
- app/components/primer/beta/progress_bar.pcss
|
|
630
630
|
- app/components/primer/beta/progress_bar.rb
|
|
631
|
+
- app/components/primer/beta/relative_time.d.ts
|
|
632
|
+
- app/components/primer/beta/relative_time.js
|
|
631
633
|
- app/components/primer/beta/relative_time.rb
|
|
634
|
+
- app/components/primer/beta/relative_time.ts
|
|
632
635
|
- app/components/primer/beta/spinner.html.erb
|
|
633
636
|
- app/components/primer/beta/spinner.rb
|
|
634
637
|
- app/components/primer/beta/state.css
|
|
@@ -663,39 +666,16 @@ files:
|
|
|
663
666
|
- app/components/primer/component.rb
|
|
664
667
|
- app/components/primer/conditional_wrapper.rb
|
|
665
668
|
- app/components/primer/content.rb
|
|
666
|
-
- app/components/primer/dropdown.rb
|
|
667
|
-
- app/components/primer/dropdown/menu.rb
|
|
668
|
-
- app/components/primer/hellip_button.rb
|
|
669
669
|
- app/components/primer/icon_button.html.erb
|
|
670
670
|
- app/components/primer/icon_button.rb
|
|
671
|
-
- app/components/primer/label_component.rb
|
|
672
671
|
- app/components/primer/layout_component.html.erb
|
|
673
672
|
- app/components/primer/layout_component.rb
|
|
674
|
-
- app/components/primer/link_component.rb
|
|
675
|
-
- app/components/primer/local_time.d.ts
|
|
676
|
-
- app/components/primer/local_time.js
|
|
677
|
-
- app/components/primer/local_time.rb
|
|
678
|
-
- app/components/primer/local_time.ts
|
|
679
|
-
- app/components/primer/markdown.rb
|
|
680
|
-
- app/components/primer/menu_component.rb
|
|
681
673
|
- app/components/primer/navigation/tab_component.html.erb
|
|
682
674
|
- app/components/primer/navigation/tab_component.rb
|
|
683
|
-
- app/components/primer/octicon_component.rb
|
|
684
|
-
- app/components/primer/octicon_symbols_component.rb
|
|
685
|
-
- app/components/primer/popover_component.rb
|
|
686
675
|
- app/components/primer/primer.d.ts
|
|
687
676
|
- app/components/primer/primer.js
|
|
688
677
|
- app/components/primer/primer.pcss
|
|
689
678
|
- app/components/primer/primer.ts
|
|
690
|
-
- app/components/primer/spinner_component.rb
|
|
691
|
-
- app/components/primer/state_component.rb
|
|
692
|
-
- app/components/primer/subhead_component.rb
|
|
693
|
-
- app/components/primer/tab_container_component.rb
|
|
694
|
-
- app/components/primer/time_ago_component.d.ts
|
|
695
|
-
- app/components/primer/time_ago_component.js
|
|
696
|
-
- app/components/primer/time_ago_component.rb
|
|
697
|
-
- app/components/primer/time_ago_component.ts
|
|
698
|
-
- app/components/primer/timeline_item_component.rb
|
|
699
679
|
- app/components/primer/tooltip.rb
|
|
700
680
|
- app/components/primer/truncate.css
|
|
701
681
|
- app/components/primer/truncate.css.json
|
|
@@ -927,6 +907,8 @@ files:
|
|
|
927
907
|
- previews/primer/alpha/menu_preview/playground.html.erb
|
|
928
908
|
- previews/primer/alpha/nav_list_preview.rb
|
|
929
909
|
- previews/primer/alpha/segmented_control_preview.rb
|
|
910
|
+
- previews/primer/alpha/segmented_control_preview/with_label_and_caption.html.erb
|
|
911
|
+
- previews/primer/alpha/segmented_control_preview/with_subhead_actions.html.erb
|
|
930
912
|
- previews/primer/alpha/tab_nav_preview.rb
|
|
931
913
|
- previews/primer/alpha/tab_panels_preview.rb
|
|
932
914
|
- previews/primer/alpha/text_field_preview.rb
|
|
@@ -1001,13 +983,12 @@ files:
|
|
|
1001
983
|
- previews/primer/forms/forms_preview/submit_button_form.html.erb
|
|
1002
984
|
- previews/primer/forms/forms_preview/text_field_and_checkbox_form.html.erb
|
|
1003
985
|
- previews/primer/layout_component_preview.rb
|
|
1004
|
-
- previews/primer/local_time_component_preview.rb
|
|
1005
|
-
- previews/primer/time_ago_component_preview.rb
|
|
1006
986
|
- previews/primer/url_helpers.rb
|
|
1007
987
|
- static/arguments.json
|
|
1008
988
|
- static/assets/view-components.svg
|
|
1009
989
|
- static/audited_at.json
|
|
1010
990
|
- static/constants.json
|
|
991
|
+
- static/previews.json
|
|
1011
992
|
- static/statuses.json
|
|
1012
993
|
homepage: https://github.com/primer/view_components
|
|
1013
994
|
licenses:
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Primer
|
|
4
|
-
# Use `LocalTime` to format a date and time in the user's preferred locale format. This component requires JavaScript.
|
|
5
|
-
class LocalTime < Primer::Component
|
|
6
|
-
status :deprecated
|
|
7
|
-
|
|
8
|
-
DEFAULT_DIGIT_TYPE = :numeric
|
|
9
|
-
DIGIT_TYPE_OPTIONS = [DEFAULT_DIGIT_TYPE, :"2-digit"].freeze
|
|
10
|
-
|
|
11
|
-
DEFAULT_TEXT_TYPE = :short
|
|
12
|
-
TEXT_TYPE_OPTIONS = [DEFAULT_TEXT_TYPE, :long].freeze
|
|
13
|
-
|
|
14
|
-
# @example Default
|
|
15
|
-
# <%= render(Primer::LocalTime.new(datetime: DateTime.parse("2014-06-01T13:05:07Z"))) %>
|
|
16
|
-
#
|
|
17
|
-
# @example All the options
|
|
18
|
-
# <%= render(Primer::LocalTime.new(datetime: DateTime.parse("2014-06-01T13:05:07Z"), weekday: :long, year: :"2-digit", month: :long, day: :"2-digit", hour: :"2-digit", minute: :"2-digit", second: :"2-digit", time_zone_name: :long)) %>
|
|
19
|
-
#
|
|
20
|
-
# @example With initial content
|
|
21
|
-
# <%= render(Primer::LocalTime.new(datetime: DateTime.parse("2014-06-01T13:05:07Z"))) do %>
|
|
22
|
-
# <!-- This content will be replaced once the component connects -->
|
|
23
|
-
# 2014/06/01 13:05
|
|
24
|
-
# <% end %>
|
|
25
|
-
#
|
|
26
|
-
# @param datetime [DateTime] The date to parse
|
|
27
|
-
# @param initial_text [String] Text to render before component is initialized
|
|
28
|
-
# @param weekday [Symbol] <%= one_of(Primer::LocalTime::TEXT_TYPE_OPTIONS) %>
|
|
29
|
-
# @param year [Symbol] <%= one_of(Primer::LocalTime::DIGIT_TYPE_OPTIONS) %>
|
|
30
|
-
# @param month [Symbol] <%= one_of(Primer::LocalTime::TEXT_TYPE_OPTIONS) %>
|
|
31
|
-
# @param day [Symbol] <%= one_of(Primer::LocalTime::DIGIT_TYPE_OPTIONS) %>
|
|
32
|
-
# @param hour [Symbol] <%= one_of(Primer::LocalTime::DIGIT_TYPE_OPTIONS) %>
|
|
33
|
-
# @param minute [Symbol] <%= one_of(Primer::LocalTime::DIGIT_TYPE_OPTIONS) %>
|
|
34
|
-
# @param second [Symbol] <%= one_of(Primer::LocalTime::DIGIT_TYPE_OPTIONS) %>
|
|
35
|
-
# @param time_zone_name [Symbol] <%= one_of(Primer::LocalTime::TEXT_TYPE_OPTIONS) %>
|
|
36
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
37
|
-
def initialize(datetime:, initial_text: nil, weekday: DEFAULT_TEXT_TYPE, year: DEFAULT_DIGIT_TYPE, month: DEFAULT_TEXT_TYPE, day: DEFAULT_DIGIT_TYPE, hour: DEFAULT_DIGIT_TYPE, minute: DEFAULT_DIGIT_TYPE, second: DEFAULT_DIGIT_TYPE, time_zone_name: DEFAULT_TEXT_TYPE, **system_arguments)
|
|
38
|
-
@system_arguments = deny_tag_argument(**system_arguments)
|
|
39
|
-
|
|
40
|
-
@datetime = datetime
|
|
41
|
-
|
|
42
|
-
@system_arguments[:tag] = "relative-time"
|
|
43
|
-
@system_arguments[:threshold] = "PT0S"
|
|
44
|
-
@system_arguments[:prefix] = ""
|
|
45
|
-
@system_arguments[:datetime] = datetime
|
|
46
|
-
|
|
47
|
-
@initial_text = initial_text
|
|
48
|
-
|
|
49
|
-
@system_arguments[:weekday] = fetch_or_fallback(TEXT_TYPE_OPTIONS, weekday, DEFAULT_TEXT_TYPE)
|
|
50
|
-
@system_arguments[:year] = fetch_or_fallback(DIGIT_TYPE_OPTIONS, year, DEFAULT_DIGIT_TYPE)
|
|
51
|
-
@system_arguments[:month] = fetch_or_fallback(TEXT_TYPE_OPTIONS, month, DEFAULT_TEXT_TYPE)
|
|
52
|
-
@system_arguments[:day] = fetch_or_fallback(DIGIT_TYPE_OPTIONS, day, DEFAULT_DIGIT_TYPE)
|
|
53
|
-
@system_arguments[:hour] = fetch_or_fallback(DIGIT_TYPE_OPTIONS, hour, DEFAULT_DIGIT_TYPE)
|
|
54
|
-
@system_arguments[:minute] = fetch_or_fallback(DIGIT_TYPE_OPTIONS, minute, DEFAULT_DIGIT_TYPE)
|
|
55
|
-
@system_arguments[:second] = fetch_or_fallback(DIGIT_TYPE_OPTIONS, second, DEFAULT_DIGIT_TYPE)
|
|
56
|
-
@system_arguments[:"time-zone-name"] = fetch_or_fallback(TEXT_TYPE_OPTIONS, time_zone_name, DEFAULT_TEXT_TYPE)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def call
|
|
60
|
-
render(Primer::BaseComponent.new(**@system_arguments).with_content(@initial_text || @datetime.strftime("%B %-d, %Y %H:%M %Z")))
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@github/relative-time-element';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@github/relative-time-element';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Primer
|
|
4
|
-
# Use `TimeAgo` to display a time relative to how long ago it was. This component requires JavaScript.
|
|
5
|
-
class TimeAgoComponent < Primer::Component
|
|
6
|
-
status :deprecated
|
|
7
|
-
|
|
8
|
-
# @example Default
|
|
9
|
-
# <%= render(Primer::TimeAgoComponent.new(time: Time.at(628232400))) %>
|
|
10
|
-
#
|
|
11
|
-
# @param time [Time] The time to be formatted
|
|
12
|
-
# @param micro [Boolean] If true then the text will be formatted in "micro" mode, using as few characters as possible
|
|
13
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
14
|
-
def initialize(time:, micro: false, **system_arguments)
|
|
15
|
-
@system_arguments = deny_tag_argument(**system_arguments)
|
|
16
|
-
@system_arguments[:datetime] = time.utc.iso8601
|
|
17
|
-
@system_arguments[:classes] = class_names("no-wrap", @system_arguments[:classes])
|
|
18
|
-
@system_arguments[:tag] = "relative-time"
|
|
19
|
-
@system_arguments[:tense] = "past"
|
|
20
|
-
@system_arguments[:format] = "micro" if micro
|
|
21
|
-
@time = time
|
|
22
|
-
@micro = micro
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def call
|
|
26
|
-
render(Primer::BaseComponent.new(**@system_arguments)) { time_in_words }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
def time_in_words
|
|
32
|
-
return @time.in_time_zone.strftime("%b %-d, %Y") unless @micro
|
|
33
|
-
|
|
34
|
-
seconds_ago = Time.current - @time
|
|
35
|
-
|
|
36
|
-
if seconds_ago < 1.minute
|
|
37
|
-
# :nocov:
|
|
38
|
-
"1m"
|
|
39
|
-
# :nocov:
|
|
40
|
-
elsif seconds_ago >= 1.minute && seconds_ago < 1.hour
|
|
41
|
-
"#{(seconds_ago / 60).floor}m"
|
|
42
|
-
elsif seconds_ago >= 1.hour && seconds_ago < 1.day
|
|
43
|
-
"#{(seconds_ago / 60 / 60).floor}h"
|
|
44
|
-
elsif seconds_ago >= 1.day && seconds_ago < 1.year
|
|
45
|
-
"#{(seconds_ago / 60 / 60 / 24).floor}d"
|
|
46
|
-
elsif seconds_ago >= 1.year
|
|
47
|
-
"#{(seconds_ago / 60 / 60 / 24 / 365).floor}y"
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@github/relative-time-element'
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# rubocop:disable Primer/ComponentNameMigration
|
|
4
|
-
|
|
5
|
-
module Primer
|
|
6
|
-
# @label LocalTime
|
|
7
|
-
class LocalTimeComponentPreview < ViewComponent::Preview
|
|
8
|
-
# @param datetime datetime-local
|
|
9
|
-
# @param weekday [Symbol] select [long, short]
|
|
10
|
-
# @param month [Symbol] select [long, short]
|
|
11
|
-
# @param year [Symbol] select [numeric, "2-digit"]
|
|
12
|
-
# @param day [Symbol] select [numeric, "2-digit"]
|
|
13
|
-
# @param hour [Symbol] select [numeric, "2-digit"]
|
|
14
|
-
# @param minute [Symbol] select [numeric, "2-digit"]
|
|
15
|
-
# @param second [Symbol] select [numeric, "2-digit"]
|
|
16
|
-
# @param time_zone_name [Symbol] select [long, short]
|
|
17
|
-
def playground(datetime: "2014-04-01T16:30:00-08:00", weekday: :short, month: :short, year: :numeric, day: :numeric, hour: :numeric, minute: :numeric, second: :numeric, time_zone_name: :short)
|
|
18
|
-
render(Primer::LocalTime.new(datetime: DateTime.parse(datetime), weekday: weekday, month: month, year: year, day: day, hour: hour, minute: minute, second: second, time_zone_name: time_zone_name))
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# @param datetime datetime-local
|
|
22
|
-
# @param weekday [Symbol] select [long, short]
|
|
23
|
-
# @param month [Symbol] select [long, short]
|
|
24
|
-
# @param year [Symbol] select [numeric, "2-digit"]
|
|
25
|
-
# @param day [Symbol] select [numeric, "2-digit"]
|
|
26
|
-
# @param hour [Symbol] select [numeric, "2-digit"]
|
|
27
|
-
# @param minute [Symbol] select [numeric, "2-digit"]
|
|
28
|
-
# @param second [Symbol] select [numeric, "2-digit"]
|
|
29
|
-
# @param time_zone_name [Symbol] select [long, short]
|
|
30
|
-
def default(datetime: "2014-04-01T16:30:00-08:00", weekday: :short, month: :short, year: :numeric, day: :numeric, hour: :numeric, minute: :numeric, second: :numeric, time_zone_name: :short)
|
|
31
|
-
render(Primer::LocalTime.new(datetime: DateTime.parse(datetime), weekday: weekday, month: month, year: year, day: day, hour: hour, minute: minute, second: second, time_zone_name: time_zone_name))
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# @hidden
|
|
35
|
-
def with_all_the_options
|
|
36
|
-
render(Primer::LocalTime.new(
|
|
37
|
-
datetime: DateTime.parse("2016-06-01T13:05:07Z"),
|
|
38
|
-
weekday: :long,
|
|
39
|
-
year: :"2-digit",
|
|
40
|
-
month: :long,
|
|
41
|
-
day: :"2-digit",
|
|
42
|
-
hour: :"2-digit",
|
|
43
|
-
minute: :"2-digit",
|
|
44
|
-
second: :"2-digit",
|
|
45
|
-
time_zone_name: :long
|
|
46
|
-
))
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# @label With replaceable content
|
|
50
|
-
#
|
|
51
|
-
# @param initial_text [String] textarea
|
|
52
|
-
def with_contents(initial_text: "This will be replaced")
|
|
53
|
-
render Primer::LocalTime.new(datetime: DateTime.parse("2014-04-01T16:30:00-08:00"), initial_text: initial_text)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
# rubocop:enable Primer/ComponentNameMigration
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# rubocop:disable Primer/ComponentNameMigration
|
|
4
|
-
|
|
5
|
-
module Primer
|
|
6
|
-
# @label TimeAgoComponent
|
|
7
|
-
class TimeAgoComponentPreview < ViewComponent::Preview
|
|
8
|
-
# @label Playground
|
|
9
|
-
#
|
|
10
|
-
# @param time datetime-local
|
|
11
|
-
# @param micro [Boolean] toggle
|
|
12
|
-
def playground(time: Time.zone.now.to_s, micro: false)
|
|
13
|
-
render(Primer::TimeAgoComponent.new(time: DateTime.parse(time), micro: micro))
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# @param time datetime-local
|
|
17
|
-
# @param micro [Boolean] toggle
|
|
18
|
-
def default(time: Time.zone.now.to_s, micro: false)
|
|
19
|
-
render(Primer::TimeAgoComponent.new(time: DateTime.parse(time), micro: micro))
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def micro
|
|
23
|
-
render(Primer::TimeAgoComponent.new(time: Time.zone.now, micro: true))
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
# rubocop:enable Primer/ComponentNameMigration
|