playbook_ui 12.37.0.pre.alpha.PLAY951collapsiblenav31062 → 12.37.0.pre.alpha.PLAY951collapsiblenav31074

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 +182 -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 +19 -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,188 @@
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_bolder {
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_bold {
29
+ .pb_nav_list_item_text {
30
+ font-weight: $bold;
31
+ }
32
+ .pb_collapsible_main_kit {
33
+ .pb_nav_list_item_text_collapsible {
34
+ font-weight: $bold !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
+ .font_regular {
41
+ .pb_nav_list_item_text {
42
+ font-weight: $regular;
43
+ }
44
+ .pb_collapsible_main_kit {
45
+ .pb_nav_list_item_text_collapsible {
46
+ font-weight: $regular !important;
47
+ }
48
+ }
49
+ }
50
+
51
+
52
+ //styling for default variant with collapsible
53
+ &[class*="_normal"] {
54
+ [class*="pb_collapsible_nav_item"] {
55
+ .pb_collapsible_content_kit {
56
+ margin-left: $space_lg + 3;
29
57
  }
30
58
  .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;
59
+ border-radius: unset;
60
+ }
61
+ &[class*="_active"] {
62
+ .pb_collapsible_main_kit {
63
+ background-color: $active_light;
64
+ }
65
+ .pb_nav_list_item_link {
66
+ border-color: transparent !important;
67
+ .pb_nav_list_item_text {
68
+ color: unset !important;
69
+ font-weight: $regular !important;
70
+ }
38
71
  }
39
72
  }
40
73
 
41
- &:hover {
42
- background-color: unset;
74
+ &.dark {
75
+ border-color: $border_dark;
76
+ .pb_collapsible_main_kit:hover {
77
+ .pb_nav_list_item_text_collapsible {
78
+ color: $white !important;
79
+ }
80
+ }
81
+ &[class*="_active"] {
82
+ .pb_collapsible_main_kit {
83
+ background-color: mix($white, $card_dark, 20%);
84
+ .pb_nav_list_item_text_collapsible,
85
+ svg {
86
+ color: $white !important;
87
+ }
88
+ }
89
+ }
43
90
  }
44
- .pb_collapsible_main_kit:hover {
45
- .pb_nav_list_item_text_collapsible {
46
- color: $white !important;
91
+ }
92
+ }
93
+
94
+ //styling bold variant to work with collapsible
95
+ &[class*="_bold"] {
96
+ [class*="pb_collapsible_nav_item"] {
97
+ &[class*="_active"] {
98
+ .pb_collapsible_main_kit {
99
+ background-color: $primary !important;
100
+ border-radius: $border_rad_heavier;
101
+ .pb_nav_list_item_text_collapsible,
102
+ .pb_nav_list_item_icon_collapsible,
103
+ .icon_wrapper,
104
+ .pb_icon_kit {
105
+ color: $white !important;
106
+ }
107
+ }
108
+ .pb_nav_list_item_link {
109
+ background-color: unset !important;
110
+ box-shadow: unset !important;
111
+ &:hover {
112
+ background-color: rgba($primary, 0.03) !important;
113
+ .pb_nav_list_item_text {
114
+ color: $primary !important;
115
+ }
116
+ }
117
+ .pb_nav_list_item_text {
118
+ font-weight: $regular !important;
119
+ }
47
120
  }
48
121
  }
122
+ }
123
+ }
49
124
 
50
- .icon_wrapper {
51
- &:hover {
52
- background-color: mix($primary, $card_light, 40%);
125
+ //styling for subtle variant with collapsible
126
+ &[class*="_subtle"] {
127
+ [class*="pb_collapsible_nav_item"] {
128
+ &[class*="_active"] {
129
+ .pb_collapsible_main_kit {
130
+ background-color: $primary !important;
131
+ border-radius: $border_rad_heavier;
132
+ .pb_nav_list_item_text_collapsible,
133
+ .pb_nav_list_item_icon_collapsible,
134
+ .icon_wrapper,
53
135
  .pb_icon_kit {
54
- color: $primary !important;
136
+ color: $white !important;
137
+ }
138
+ }
139
+
140
+ &:hover {
141
+ background-color: unset;
142
+ }
143
+ .pb_collapsible_main_kit:hover {
144
+ .pb_nav_list_item_text_collapsible {
145
+ color: $white !important;
146
+ }
147
+ }
148
+
149
+ .icon_wrapper {
150
+ &:hover {
151
+ background-color: mix($primary, $card_light, 40%);
152
+ .pb_icon_kit {
153
+ color: $primary !important;
154
+ }
55
155
  }
56
156
  }
57
157
  }
58
158
  }
159
+ }
160
+
161
+ [class*="pb_collapsible_nav_item"] {
162
+ &[class*="_active"] {
163
+ background-color: unset !important;
164
+ .pb_nav_list_item_link {
165
+ color: unset !important;
166
+ }
167
+ }
168
+
169
+ .pb_nav_list_item_link_collapsible {
170
+ &:focus-visible {
171
+ outline: none;
172
+ }
173
+ }
174
+
175
+ .pb_collapsible_main_kit {
176
+ &:focus-visible {
177
+ box-shadow: 0px 0px 0px 2px $primary_action;
178
+ border-radius: $border_rad_heavier;
179
+ }
180
+ }
181
+
182
+ //Make sure link is entire width of navitem when in collapsible
183
+ .pb_collapsible_main_kit {
184
+ .pb_flex_item_kit:first-child {
185
+ width: 100%;
186
+ }
187
+ }
59
188
 
60
189
  &:hover {
61
190
  .pb_nav_list_item_link_collapsible {
@@ -63,12 +192,23 @@
63
192
  }
64
193
  }
65
194
 
66
- .pb_collapsible_main_kit:hover {
195
+ // vertical line on left of collapsible content
196
+ .pb_collapsible_content_kit {
197
+ margin-left: $space_sm + 2;
198
+ border-left: 1px solid transparent;
199
+ }
200
+
201
+ .pb_collapsible_main_kit {
202
+ transition-property: color, border-color, background-color;
203
+ transition-duration: 0.15s;
204
+ transition-timing-function: $bezier;
67
205
  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;
206
+ &:hover {
207
+ background-color: mix($primary, $card_light, 10%);
208
+ .pb_nav_list_item_text_collapsible,
209
+ svg {
210
+ color: $primary !important;
211
+ }
72
212
  }
73
213
  }
74
214
 
@@ -82,15 +222,6 @@
82
222
  @include collapsible_trail_class;
83
223
  }
84
224
 
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
225
  .icon_wrapper {
95
226
  border-radius: $border_radius_rounded;
96
227
  width: $space_sm + 3;
@@ -105,6 +236,12 @@
105
236
  }
106
237
 
107
238
  &.dark {
239
+ .pb_nav_list_kit_item {
240
+ border-color: $border_dark;
241
+ .pb_nav_list_item_text {
242
+ color: $text_dk_light !important;
243
+ }
244
+ }
108
245
  &[class*="pb_nav_list_kit_item"] [class*="_link"]:hover {
109
246
  .pb_nav_list_item_text {
110
247
  color: $white !important;
@@ -141,7 +278,6 @@
141
278
  }
142
279
  }
143
280
 
144
- &[class*="pb_collapsible_nav_item"][class*="_emphasized"],
145
281
  &[class*="pb_collapsible_nav_item"][class*="_collapsible_trail"] {
146
282
  .pb_collapsible_content_kit {
147
283
  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" | "bolder",
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" : fontWeight === 'bolder' ? "font_bolder" : "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="bolder"
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="bolder"
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="bolder"
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="bolder"
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:"bolder", font_size:"small", collapsible: true, icon_left:"city", collapsible_trail: true }) 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:"bolder", font_size:"small", collapsible: true, icon_left: "theater-masks", collapsible_trail:true }) 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:"bolder", font_size:"small", collapsible: true, icon_left: "city", collapsible_trail:true }) 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="bolder"
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="bolder"
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="bolder"
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 bolder],
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,23 @@ 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
+ case font_weight
60
+ when "bold"
61
+ "font_bold"
62
+ when "bolder"
63
+ "font_bolder"
64
+ else
65
+ "font_regular"
66
+ end
56
67
  end
57
68
 
58
69
  def collapsible_trail_class
59
70
  collapsible_trail ? "collapsible_trail" : nil
60
71
  end
61
72
 
62
- def emphasized_class
63
- emphasized ? "emphasized" : nil
73
+ def font_size_class
74
+ font_size === "small" ? "font_size_small" : "font_size_normal"
64
75
  end
65
76
  end
66
77
  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
  </>