playbook_ui 12.37.0.pre.alpha.PLAY951collapsiblenav31062 → 12.37.0.pre.alpha.PLAY951collapsiblenav31073

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
  3. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
  4. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +29 -5
  5. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
  6. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
  7. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
  8. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
  9. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
  10. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
  11. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
  12. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
  13. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
  14. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
  15. data/app/pb_kits/playbook/pb_kit/dateTime.ts +146 -63
  16. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
  17. data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
  18. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +170 -46
  19. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
  20. data/app/pb_kits/playbook/pb_nav/_item.tsx +9 -7
  21. data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
  22. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +0 -1
  23. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  24. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +8 -2
  25. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +3 -2
  26. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +3 -3
  27. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.jsx +12 -5
  28. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -1
  29. data/app/pb_kits/playbook/pb_nav/item.rb +12 -8
  30. data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
  31. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
  32. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
  33. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
  34. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
  35. data/dist/playbook-rails.js +7 -7
  36. data/lib/playbook/version.rb +1 -1
  37. metadata +3 -3
  38. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +0 -120
@@ -3,59 +3,176 @@
3
3
  @import "../tokens/border_radius";
4
4
  @import "../tokens/titles";
5
5
  @import "../tokens/typography";
6
+ @import "./mixins";
6
7
 
7
8
  [class^="pb_nav_list"] {
8
- [class*="pb_collapsible_nav_item"] {
9
- @mixin collapsible_trail_class {
10
- .pb_collapsible_content_kit {
11
- margin-left: $space_md - 2 !important;
12
- border-left: 2px solid $border_light;
9
+ .font_size_small {
10
+ .pb_nav_list_item_text,
11
+ .pb_nav_list_item_text_collapsible {
12
+ font-size: $font_small !important;
13
+ }
14
+ }
15
+
16
+ .font_bold {
17
+ .pb_nav_list_item_text {
18
+ @include pb_title_4;
19
+ }
20
+ .pb_collapsible_main_kit {
21
+ .pb_nav_list_item_text_collapsible {
22
+ @include pb_title_4;
23
+ font-weight: $bolder !important;
13
24
  }
14
25
  }
26
+ }
15
27
 
16
- @mixin bold_class {
17
- .pb_collapsible_main_kit {
18
- .pb_nav_list_item_text_collapsible {
19
- @include pb_title_4;
20
- font-weight: $bolder !important;
21
- }
28
+ .font_regular {
29
+ .pb_nav_list_item_text {
30
+ font-weight: $regular;
31
+ }
32
+ .pb_collapsible_main_kit {
33
+ .pb_nav_list_item_text_collapsible {
34
+ font-weight: $regular !important;
22
35
  }
23
36
  }
37
+ }
24
38
 
25
- &[class*="_active"] {
26
- background-color: unset !important;
27
- .pb_nav_list_item_link {
28
- color: unset !important;
39
+
40
+ //styling for default variant with collapsible
41
+ &[class*="_normal"] {
42
+ [class*="pb_collapsible_nav_item"] {
43
+ .pb_collapsible_content_kit {
44
+ margin-left: $space_lg + 3;
29
45
  }
30
46
  .pb_collapsible_main_kit {
31
- background-color: $primary !important;
32
- border-radius: $border_rad_heavier;
33
- .pb_nav_list_item_text_collapsible,
34
- .pb_nav_list_item_icon_collapsible,
35
- .icon_wrapper,
36
- .pb_icon_kit {
37
- color: $white !important;
47
+ border-radius: unset;
48
+ }
49
+ &[class*="_active"] {
50
+ .pb_collapsible_main_kit {
51
+ background-color: $active_light;
52
+ }
53
+ .pb_nav_list_item_link {
54
+ border-color: transparent !important;
55
+ .pb_nav_list_item_text {
56
+ color: unset !important;
57
+ font-weight: $regular !important;
58
+ }
38
59
  }
39
60
  }
40
61
 
41
- &:hover {
42
- background-color: unset;
62
+ &.dark {
63
+ border-color: $border_dark;
64
+ .pb_collapsible_main_kit:hover {
65
+ .pb_nav_list_item_text_collapsible {
66
+ color: $white !important;
67
+ }
68
+ }
69
+ &[class*="_active"] {
70
+ .pb_collapsible_main_kit {
71
+ background-color: mix($white, $card_dark, 20%);
72
+ .pb_nav_list_item_text_collapsible,
73
+ svg {
74
+ color: $white !important;
75
+ }
76
+ }
77
+ }
43
78
  }
44
- .pb_collapsible_main_kit:hover {
45
- .pb_nav_list_item_text_collapsible {
46
- color: $white !important;
79
+ }
80
+ }
81
+
82
+ //styling bold variant to work with collapsible
83
+ &[class*="_bold"] {
84
+ [class*="pb_collapsible_nav_item"] {
85
+ &[class*="_active"] {
86
+ .pb_collapsible_main_kit {
87
+ background-color: $primary !important;
88
+ border-radius: $border_rad_heavier;
89
+ .pb_nav_list_item_text_collapsible,
90
+ .pb_nav_list_item_icon_collapsible,
91
+ .icon_wrapper,
92
+ .pb_icon_kit {
93
+ color: $white !important;
94
+ }
95
+ }
96
+ .pb_nav_list_item_link {
97
+ background-color: unset !important;
98
+ box-shadow: unset !important;
99
+ &:hover {
100
+ background-color: rgba($primary, 0.03) !important;
101
+ .pb_nav_list_item_text {
102
+ color: $primary !important;
103
+ }
104
+ }
105
+ .pb_nav_list_item_text {
106
+ font-weight: $regular !important;
107
+ }
47
108
  }
48
109
  }
110
+ }
111
+ }
49
112
 
50
- .icon_wrapper {
51
- &:hover {
52
- background-color: mix($primary, $card_light, 40%);
113
+ //styling for subtle variant with collapsible
114
+ &[class*="_subtle"] {
115
+ [class*="pb_collapsible_nav_item"] {
116
+ &[class*="_active"] {
117
+ .pb_collapsible_main_kit {
118
+ background-color: $primary !important;
119
+ border-radius: $border_rad_heavier;
120
+ .pb_nav_list_item_text_collapsible,
121
+ .pb_nav_list_item_icon_collapsible,
122
+ .icon_wrapper,
53
123
  .pb_icon_kit {
54
- color: $primary !important;
124
+ color: $white !important;
125
+ }
126
+ }
127
+
128
+ &:hover {
129
+ background-color: unset;
130
+ }
131
+ .pb_collapsible_main_kit:hover {
132
+ .pb_nav_list_item_text_collapsible {
133
+ color: $white !important;
134
+ }
135
+ }
136
+
137
+ .icon_wrapper {
138
+ &:hover {
139
+ background-color: mix($primary, $card_light, 40%);
140
+ .pb_icon_kit {
141
+ color: $primary !important;
142
+ }
55
143
  }
56
144
  }
57
145
  }
58
146
  }
147
+ }
148
+
149
+ [class*="pb_collapsible_nav_item"] {
150
+ &[class*="_active"] {
151
+ background-color: unset !important;
152
+ .pb_nav_list_item_link {
153
+ color: unset !important;
154
+ }
155
+ }
156
+
157
+ .pb_nav_list_item_link_collapsible {
158
+ &:focus-visible {
159
+ outline: none;
160
+ }
161
+ }
162
+
163
+ .pb_collapsible_main_kit {
164
+ &:focus-visible {
165
+ box-shadow: 0px 0px 0px 2px $primary_action;
166
+ border-radius: $border_rad_heavier;
167
+ }
168
+ }
169
+
170
+ //Make sure link is entire width of navitem when in collapsible
171
+ .pb_collapsible_main_kit {
172
+ .pb_flex_item_kit:first-child {
173
+ width: 100%;
174
+ }
175
+ }
59
176
 
60
177
  &:hover {
61
178
  .pb_nav_list_item_link_collapsible {
@@ -63,12 +180,23 @@
63
180
  }
64
181
  }
65
182
 
66
- .pb_collapsible_main_kit:hover {
183
+ // vertical line on left of collapsible content
184
+ .pb_collapsible_content_kit {
185
+ margin-left: $space_sm + 2;
186
+ border-left: 1px solid transparent;
187
+ }
188
+
189
+ .pb_collapsible_main_kit {
190
+ transition-property: color, border-color, background-color;
191
+ transition-duration: 0.15s;
192
+ transition-timing-function: $bezier;
67
193
  border-radius: $border_rad_heavier;
68
- background-color: mix($primary, $card_light, 10%);
69
- .pb_nav_list_item_text_collapsible,
70
- svg {
71
- color: $primary !important;
194
+ &:hover {
195
+ background-color: mix($primary, $card_light, 10%);
196
+ .pb_nav_list_item_text_collapsible,
197
+ svg {
198
+ color: $primary !important;
199
+ }
72
200
  }
73
201
  }
74
202
 
@@ -82,15 +210,6 @@
82
210
  @include collapsible_trail_class;
83
211
  }
84
212
 
85
- &[class*="_bold_text"] {
86
- @include bold_class;
87
- }
88
-
89
- &[class*="_emphasized"] {
90
- @include collapsible_trail_class;
91
- @include bold_class;
92
- }
93
-
94
213
  .icon_wrapper {
95
214
  border-radius: $border_radius_rounded;
96
215
  width: $space_sm + 3;
@@ -105,6 +224,12 @@
105
224
  }
106
225
 
107
226
  &.dark {
227
+ .pb_nav_list_kit_item {
228
+ border-color: $border_dark;
229
+ .pb_nav_list_item_text {
230
+ color: $text_dk_light !important;
231
+ }
232
+ }
108
233
  &[class*="pb_nav_list_kit_item"] [class*="_link"]:hover {
109
234
  .pb_nav_list_item_text {
110
235
  color: $white !important;
@@ -141,7 +266,6 @@
141
266
  }
142
267
  }
143
268
 
144
- &[class*="pb_collapsible_nav_item"][class*="_emphasized"],
145
269
  &[class*="pb_collapsible_nav_item"][class*="_collapsible_trail"] {
146
270
  .pb_collapsible_content_kit {
147
271
  border-color: $border_dark;
@@ -81,6 +81,9 @@ $selector: ".pb_nav_list";
81
81
  // Horizontal Overrides
82
82
  [class*=pb_nav_list_kit_item] {
83
83
  margin: 0;
84
+ [class*=_item_text]{
85
+ font-weight: $regular;
86
+ }
84
87
  }
85
88
  [class*=_active] {
86
89
  background-color: $active_light;
@@ -101,6 +104,9 @@ $selector: ".pb_nav_list";
101
104
  // Horizontal Overrides
102
105
  [class*=pb_nav_list_kit_item] {
103
106
  margin: 0;
107
+ [class*=_item_text]{
108
+ font-weight: $regular;
109
+ }
104
110
  }
105
111
  [class*=_active] {
106
112
  [class*=_text] {
@@ -11,13 +11,13 @@ import Collapsible from '../pb_collapsible/_collapsible'
11
11
  type NavItemProps = {
12
12
  active?: boolean,
13
13
  aria?: { [key: string]: string },
14
- bold?: boolean,
15
- emphasized?: boolean,
14
+ fontWeight?: "regular" | "bold",
16
15
  children?: React.ReactNode[] | React.ReactNode,
17
16
  className?: string,
18
17
  collapsible?: boolean,
19
18
  data?: object,
20
19
  dark?: boolean,
20
+ fontSize?: "normal" | "small",
21
21
  iconLeft?: string,
22
22
  iconRight?: string | string[],
23
23
  onIconRightClick?: () => void,
@@ -36,13 +36,13 @@ const NavItem = (props: NavItemProps) => {
36
36
  const {
37
37
  active = false,
38
38
  aria = {},
39
- bold,
40
- emphasized,
39
+ fontWeight = "regular",
41
40
  children,
42
41
  className,
43
42
  collapsible,
44
43
  data = {},
45
44
  dark = false,
45
+ fontSize = "normal",
46
46
  iconLeft,
47
47
  iconRight,
48
48
  onIconRightClick,
@@ -60,12 +60,14 @@ const NavItem = (props: NavItemProps) => {
60
60
  const Tag = link ? 'a' : 'div'
61
61
  const activeClass = active === true ? 'active' : ''
62
62
  const collapsibleTrailClass = collapsible && collapsibleTrail ? 'collapsible_trail' : ''
63
- const boldClass = collapsible && bold ? 'bold' : ''
64
- const emphasizedClass = collapsible && emphasized ? 'emphasized' : ''
63
+ const fontSizeClass = fontSize === 'small' ? "font_size_small" : "font_size_normal"
64
+ const fontWeightClass = fontWeight === 'bold' ? "font_bold" : "font_regular"
65
65
  const ariaProps = buildAriaProps(aria)
66
66
  const dataProps = buildDataProps(data)
67
67
  const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass),
68
- collapsible ? buildCss('pb_collapsible_nav_item', activeClass, collapsibleTrailClass, boldClass, emphasizedClass) : '',
68
+ collapsible ? buildCss('pb_collapsible_nav_item', activeClass, collapsibleTrailClass) : '',
69
+ fontSizeClass,
70
+ fontWeightClass,
69
71
  globalProps(props),
70
72
  className)
71
73
 
@@ -0,0 +1,5 @@
1
+ @mixin collapsible_trail_class {
2
+ .pb_collapsible_content_kit {
3
+ border-color: $border_light;
4
+ }
5
+ }
@@ -27,7 +27,6 @@
27
27
  }
28
28
  [class*=_text] {
29
29
  flex: 1;
30
- font-weight: $regular;
31
30
  }
32
31
  &:hover {
33
32
  background-color: rgba($primary, 0.03);
@@ -56,7 +56,7 @@ $selector: ".pb_nav_list";
56
56
  color: $primary;
57
57
  }
58
58
  [class*=_text] {
59
- color: $primary;
59
+ color: $primary !important;
60
60
  }
61
61
  }
62
62
  }
@@ -3,9 +3,12 @@ import { Nav, NavItem } from '../..'
3
3
 
4
4
  const CollapsibleNav = (props) => {
5
5
  return (
6
- <Nav variant="subtle">
6
+ <Nav>
7
7
  <NavItem
8
+ active
8
9
  collapsible
10
+ collapsibleTrail
11
+ fontWeight="bold"
9
12
  iconLeft="city"
10
13
  iconRight={["plus", "minus"]}
11
14
  link="#"
@@ -29,8 +32,9 @@ const CollapsibleNav = (props) => {
29
32
  />
30
33
  </NavItem>
31
34
  <NavItem
32
- active
33
35
  collapsible
36
+ collapsibleTrail
37
+ // fontWeight="bold"
34
38
  iconLeft="theater-masks"
35
39
  iconRight={["plus", "minus"]}
36
40
  link="#"
@@ -55,6 +59,8 @@ const CollapsibleNav = (props) => {
55
59
  </NavItem>
56
60
  <NavItem
57
61
  collapsible
62
+ collapsibleTrail
63
+ // fontWeight="bold"
58
64
  iconLeft="city"
59
65
  iconRight={["plus", "minus"]}
60
66
  link="#"
@@ -18,14 +18,15 @@ const CollapsibleNavCustom = (props) => {
18
18
 
19
19
  return (
20
20
  <>
21
- <Nav variant='subtle'>
21
+ <Nav variant='bold'>
22
22
  {navItems.map((text, index) => {
23
23
  const [collapsed] = collapsibles[index]
24
24
  return (
25
25
  <NavItem
26
26
  collapsed={collapsed}
27
27
  collapsible
28
- emphasized
28
+ collapsibleTrail
29
+ fontWeight="bold"
29
30
  iconLeft="chevron-down"
30
31
  id={`collapsible-nav-item-${index + 1}`}
31
32
  key={index}
@@ -1,19 +1,19 @@
1
1
  <%= pb_rails("nav", props: { variant: "subtle" }) do %>
2
- <%= pb_rails("nav/item", props: { text: "Overview", link: "#", emphasized: true, collapsible: true, icon_left:"city" }) do %>
2
+ <%= pb_rails("nav/item", props: { text: "Overview", link: "#", font_weight:"bold", font_size:"small", collapsible: true, icon_left:"city" }) do %>
3
3
  <%= pb_rails("nav", props: { variant: "subtle" }) do %>
4
4
  <%= pb_rails("nav/item", props: { text: "City", link: "#" }) %>
5
5
  <%= pb_rails("nav/item", props: { text: "People", link: "#" }) %>
6
6
  <%= pb_rails("nav/item", props: { text: "Business", link: "#" }) %>
7
7
  <% end %>
8
8
  <% end %>
9
- <%= pb_rails("nav/item", props: { text: "Albums", link: "#", emphasized: true, collapsible: true, icon_left: "theater-masks" }) do %>
9
+ <%= pb_rails("nav/item", props: { text: "Albums", link: "#", font_weight:"bold", font_size:"small", collapsible: true, icon_left: "theater-masks" }) do %>
10
10
  <%= pb_rails("nav", props: { variant: "subtle" }) do %>
11
11
  <%= pb_rails("nav/item", props: { text: "Entertainment", link: "#" }) %>
12
12
  <%= pb_rails("nav/item", props: { text: "Food", link: "#" }) %>
13
13
  <%= pb_rails("nav/item", props: { text: "Style", link: "#" }) %>
14
14
  <% end %>
15
15
  <% end %>
16
- <%= pb_rails("nav/item", props: { text: "Similar Artists", link: "#", emphasized: true, collapsible: true, icon_left: "city" }) do %>
16
+ <%= pb_rails("nav/item", props: { text: "Similar Artists", link: "#", font_weight:"bold", font_size:"small", collapsible: true, icon_left: "city" }) do %>
17
17
  <%= pb_rails("nav", props: { variant: "subtle" }) do %>
18
18
  <%= pb_rails("nav/item", props: { text: "City", link: "#" }) %>
19
19
  <%= pb_rails("nav/item", props: { text: "People", link: "#" }) %>
@@ -3,10 +3,13 @@ import { Nav, NavItem } from '../..'
3
3
 
4
4
  const CollapsibleNavEmphasize = (props) => {
5
5
  return (
6
- <Nav variant="subtle">
6
+ <Nav variant="bold">
7
7
  <NavItem
8
- collapsible
9
- emphasized
8
+ active
9
+ collapsible
10
+ collapsibleTrail
11
+ fontSize="small"
12
+ fontWeight="bold"
10
13
  iconLeft="city"
11
14
  iconRight={["plus", "minus"]}
12
15
  link="#"
@@ -31,7 +34,9 @@ const CollapsibleNavEmphasize = (props) => {
31
34
  </NavItem>
32
35
  <NavItem
33
36
  collapsible
34
- emphasized
37
+ collapsibleTrail
38
+ fontSize="small"
39
+ fontWeight="bold"
35
40
  iconLeft="theater-masks"
36
41
  iconRight={["plus", "minus"]}
37
42
  link="#"
@@ -56,7 +61,9 @@ const CollapsibleNavEmphasize = (props) => {
56
61
  </NavItem>
57
62
  <NavItem
58
63
  collapsible
59
- emphasized
64
+ collapsibleTrail
65
+ fontSize="small"
66
+ fontWeight="bold"
60
67
  iconLeft="city"
61
68
  iconRight={["plus", "minus"]}
62
69
  link="#"
@@ -1 +1 @@
1
- The `emphasized` prop can be passed to NavItem for a more emphasized look for the collapsible Nav.
1
+ The ` navBold` prop can be passed to NavItem
@@ -4,9 +4,13 @@ module Playbook
4
4
  module PbNav
5
5
  class Item < Playbook::KitBase
6
6
  prop :active, type: Playbook::Props::Boolean, default: false
7
- prop :bold, type: Playbook::Props::Boolean, default: false
7
+ prop :font_size, type: Playbook::Props::Enum,
8
+ values: %w[normal small],
9
+ default: "normal"
10
+ prop :font_weight, type: Playbook::Props::Enum,
11
+ values: %w[bold regular],
12
+ default: "regular"
8
13
  prop :collapsible, type: Playbook::Props::Boolean, default: false
9
- prop :emphasized, type: Playbook::Props::Boolean, default: false
10
14
  prop :link
11
15
  prop :text
12
16
  prop :collapsible_trail, type: Playbook::Props::Boolean, default: false
@@ -18,9 +22,9 @@ module Playbook
18
22
  default: "_self"
19
23
  def classname
20
24
  if collapsible
21
- "pb_collapsible_nav_item #{generate_classname('pb_nav_list_kit_item', active_class, bold_class, collapsible_trail_class, emphasized_class)}"
25
+ "#{generate_classname('pb_nav_list_kit_item', active_class)} #{generate_classname('pb_collapsible_nav_item', active_class, collapsible_trail_class)} #{font_size_class} #{font_weight_class}"
22
26
  else
23
- generate_classname("pb_nav_list_kit_item", active_class)
27
+ "#{generate_classname('pb_nav_list_kit_item', active_class)} #{font_size_class} #{font_weight_class}"
24
28
  end
25
29
  end
26
30
 
@@ -51,16 +55,16 @@ module Playbook
51
55
  active ? "active" : nil
52
56
  end
53
57
 
54
- def bold_class
55
- bold ? "bold" : nil
58
+ def font_weight_class
59
+ font_weight === "bold" ? "font_bold" : "font_regular"
56
60
  end
57
61
 
58
62
  def collapsible_trail_class
59
63
  collapsible_trail ? "collapsible_trail" : nil
60
64
  end
61
65
 
62
- def emphasized_class
63
- emphasized ? "emphasized" : nil
66
+ def font_size_class
67
+ font_size === "small" ? "font_size_small" : "font_size_normal"
64
68
  end
65
69
  end
66
70
  end
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import classnames from "classnames";
3
3
 
4
- import DateTime from "../pb_kit/dateTime";
5
4
  import { buildCss } from "../utilities/props";
6
5
  import { globalProps, GlobalProps } from "../utilities/globalProps";
6
+ import DateTime from '../pb_kit/dateTime';
7
7
 
8
8
  import Body from "../pb_body/_body";
9
9
  import Caption from "../pb_caption/_caption";
@@ -13,7 +13,7 @@ type TimeProps = {
13
13
  align?: "left" | "center" | "right";
14
14
  className?: string | string[];
15
15
  data?: string;
16
- date: string;
16
+ date: Date;
17
17
  dark?: boolean;
18
18
  id?: string;
19
19
  showIcon?: boolean;
@@ -41,8 +41,6 @@ const Time = (props: TimeProps) => {
41
41
  className
42
42
  );
43
43
 
44
- const dateTimestamp = new DateTime({ value: date, zone: timeZone });
45
-
46
44
  return (
47
45
  <div className={classes}>
48
46
  {showIcon && (
@@ -70,18 +68,18 @@ const Time = (props: TimeProps) => {
70
68
  )
71
69
  )}
72
70
 
73
- <time dateTime={date}>
71
+ <time dateTime={date.toString()}>
74
72
  <span>
75
73
  {unstyled
76
74
  ? (
77
75
  <>
78
76
  <span>
79
- {dateTimestamp.toTimeWithMeridian()}
77
+ {DateTime.toTimeWithMeridiem(date, timeZone)}
80
78
  </span>
81
79
  {" "}
82
80
  {showTimezone && (
83
81
  <span>
84
- {dateTimestamp.toTimezone()}
82
+ {DateTime.toTimeZone(date, timeZone)}
85
83
  </span>
86
84
  )}
87
85
  </>
@@ -92,13 +90,13 @@ const Time = (props: TimeProps) => {
92
90
  <Body
93
91
  className="pb_time"
94
92
  tag="span"
95
- text={dateTimestamp.toTimeWithMeridian()}
93
+ text={DateTime.toTimeWithMeridiem(date, timeZone)}
96
94
  />{" "}
97
95
  {showTimezone && (
98
96
  <Body
99
97
  color="light"
100
98
  tag="span"
101
- text={dateTimestamp.toTimezone()}
99
+ text={DateTime.toTimeZone(date, timeZone)}
102
100
  />
103
101
  )}
104
102
  </>
@@ -108,13 +106,13 @@ const Time = (props: TimeProps) => {
108
106
  <Caption
109
107
  color="light"
110
108
  tag="span"
111
- text={dateTimestamp.toTimeWithMeridian()}
109
+ text={DateTime.toTimeWithMeridiem(date, timeZone)}
112
110
  />{" "}
113
111
  {showTimezone && (
114
112
  <Caption
115
113
  color="light"
116
114
  tag="span"
117
- text={dateTimestamp.toTimezone()}
115
+ text={DateTime.toTimeZone(date, timeZone)}
118
116
  />
119
117
  )}
120
118
  </>