playbook_ui 4.17.0.pre.alpha1 → 4.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -6
  3. data/app/pb_kits/playbook/_playbook.scss +3 -0
  4. data/app/pb_kits/playbook/data/menu.yml +1 -0
  5. data/app/pb_kits/playbook/index.js +1 -4
  6. data/app/pb_kits/playbook/packs/examples.js +2 -0
  7. data/app/pb_kits/playbook/packs/site_styles/docs/_markdown.scss +1 -1
  8. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +24 -15
  9. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.jsx +45 -0
  10. data/app/pb_kits/playbook/pb_avatar/docs/example.yml +6 -5
  11. data/app/pb_kits/playbook/pb_avatar/docs/index.js +1 -0
  12. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.html.erb +32 -0
  13. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +78 -0
  14. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +63 -0
  15. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +44 -0
  16. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +15 -0
  17. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +19 -0
  18. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +8 -0
  19. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +13 -0
  20. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +15 -0
  21. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +14 -0
  22. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +27 -0
  23. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +29 -0
  24. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +11 -0
  25. data/app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml +16 -0
  26. data/app/pb_kits/playbook/pb_avatar_action_button/docs/index.js +4 -0
  27. data/app/pb_kits/playbook/pb_badge/_badge.jsx +20 -14
  28. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +3 -2
  29. data/app/pb_kits/playbook/pb_body/_body.jsx +2 -1
  30. data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +4 -0
  31. data/app/pb_kits/playbook/pb_button/_button.jsx +2 -1
  32. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +6 -0
  33. data/app/pb_kits/playbook/pb_caption/_caption.jsx +19 -17
  34. data/app/pb_kits/playbook/pb_card/_card.html.erb +1 -1
  35. data/app/pb_kits/playbook/pb_card/_card.jsx +35 -38
  36. data/app/pb_kits/playbook/pb_card/_card.scss +0 -10
  37. data/app/pb_kits/playbook/pb_card/card.rb +9 -3
  38. data/app/pb_kits/playbook/pb_card/card_body.rb +1 -5
  39. data/app/pb_kits/playbook/pb_card/card_header.rb +0 -3
  40. data/app/pb_kits/playbook/pb_card/docs/_card_light.html.erb +2 -1
  41. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +17 -18
  42. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +4 -1
  43. data/app/pb_kits/playbook/pb_contact/_contact.html.erb +16 -3
  44. data/app/pb_kits/playbook/pb_contact/_contact.jsx +58 -34
  45. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +1 -1
  46. data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +1 -0
  47. data/app/pb_kits/playbook/pb_currency/_currency.html.erb +1 -0
  48. data/app/pb_kits/playbook/pb_currency/_currency.jsx +37 -21
  49. data/app/pb_kits/playbook/pb_currency/docs/_currency_dark.html.erb +3 -3
  50. data/app/pb_kits/playbook/pb_currency/docs/_currency_dark.jsx +2 -3
  51. data/app/pb_kits/playbook/pb_currency/docs/_currency_large.jsx +2 -3
  52. data/app/pb_kits/playbook/pb_currency/docs/_currency_medium.jsx +2 -2
  53. data/app/pb_kits/playbook/pb_currency/docs/_currency_small.html.erb +1 -1
  54. data/app/pb_kits/playbook/pb_currency/docs/_currency_small.jsx +5 -2
  55. data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +2 -2
  56. data/app/pb_kits/playbook/pb_date/_date.jsx +39 -15
  57. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +3 -1
  58. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +43 -37
  59. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.jsx +2 -2
  60. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.jsx +6 -16
  61. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +21 -18
  62. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +30 -33
  63. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.jsx +10 -15
  64. data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +8 -8
  65. data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +13 -23
  66. data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +16 -14
  67. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +13 -12
  68. data/app/pb_kits/playbook/pb_flex/_flex.jsx +35 -20
  69. data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +6 -9
  70. data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +14 -19
  71. data/app/pb_kits/playbook/pb_hashtag/_hashtag.jsx +26 -22
  72. data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +13 -12
  73. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +85 -80
  74. data/app/pb_kits/playbook/pb_icon/_icon.jsx +54 -33
  75. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.jsx +13 -9
  76. data/app/pb_kits/playbook/pb_icon_value/_icon_value.jsx +16 -20
  77. data/app/pb_kits/playbook/pb_image/_image.jsx +12 -10
  78. data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +15 -25
  79. data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +10 -17
  80. data/app/pb_kits/playbook/pb_layout/_layout.jsx +49 -45
  81. data/app/pb_kits/playbook/pb_layout/_layout.scss +76 -57
  82. data/app/pb_kits/playbook/pb_layout/docs/_layout_collection.html.erb +54 -0
  83. data/app/pb_kits/playbook/pb_layout/docs/_layout_collection.jsx +27 -0
  84. data/app/pb_kits/playbook/pb_layout/docs/example.yml +2 -0
  85. data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
  86. data/app/pb_kits/playbook/pb_layout/layout.rb +10 -2
  87. data/app/pb_kits/playbook/pb_legend/_legend.jsx +17 -15
  88. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +3 -2
  89. data/app/pb_kits/playbook/pb_list/_list.jsx +24 -21
  90. data/app/pb_kits/playbook/pb_list/docs/_description.md +7 -1
  91. data/app/pb_kits/playbook/pb_list/docs/_list_layout_left.html.erb +8 -0
  92. data/app/pb_kits/playbook/pb_list/docs/_list_layout_right.html.erb +8 -0
  93. data/app/pb_kits/playbook/pb_list/docs/example.yml +2 -0
  94. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +21 -19
  95. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +4 -11
  96. data/app/pb_kits/playbook/pb_message/_message.jsx +15 -11
  97. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +10 -10
  98. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.jsx +7 -19
  99. data/app/pb_kits/playbook/pb_nav/_nav.jsx +17 -14
  100. data/app/pb_kits/playbook/pb_online_status/_online_status.jsx +5 -13
  101. data/app/pb_kits/playbook/pb_person/_person.jsx +5 -11
  102. data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +20 -20
  103. data/app/pb_kits/playbook/pb_pill/_pill.jsx +5 -10
  104. data/app/pb_kits/playbook/pb_popover/_popover.jsx +52 -41
  105. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx +16 -12
  106. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +15 -12
  107. data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +17 -10
  108. data/app/pb_kits/playbook/pb_radio/_radio.jsx +3 -1
  109. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +19 -13
  110. data/app/pb_kits/playbook/pb_select/_select.jsx +4 -2
  111. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.jsx +12 -7
  112. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +14 -13
  113. data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +2 -1
  114. data/app/pb_kits/playbook/pb_table/_table.jsx +29 -28
  115. data/app/pb_kits/playbook/pb_table/_table.scss +1 -1
  116. data/app/pb_kits/playbook/pb_table/_table_row.jsx +6 -7
  117. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.html.erb +52 -8
  118. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.jsx +52 -8
  119. data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.md +3 -1
  120. data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +3 -5
  121. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
  122. data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +2 -1
  123. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.jsx +38 -18
  124. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +12 -11
  125. data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +7 -14
  126. data/app/pb_kits/playbook/pb_title/_title.jsx +12 -13
  127. data/app/pb_kits/playbook/pb_title/docs/_title_light.html.erb +1 -1
  128. data/app/pb_kits/playbook/pb_title_count/_title_count.jsx +49 -28
  129. data/app/pb_kits/playbook/pb_title_count/docs/_title_count_align.jsx +31 -0
  130. data/app/pb_kits/playbook/pb_title_count/docs/_title_count_default.jsx +13 -2
  131. data/app/pb_kits/playbook/pb_title_count/docs/example.yml +4 -5
  132. data/app/pb_kits/playbook/pb_title_count/docs/index.js +1 -0
  133. data/app/pb_kits/playbook/pb_title_detail/_title_detail.jsx +7 -18
  134. data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +9 -11
  135. data/app/pb_kits/playbook/pb_user/_user.jsx +37 -37
  136. data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +7 -7
  137. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +32 -30
  138. data/app/pb_kits/playbook/props.rb +48 -0
  139. data/app/pb_kits/playbook/tokens/_spacing.scss +1 -0
  140. data/app/pb_kits/playbook/utilities/_spacing.scss +42 -0
  141. data/app/pb_kits/playbook/utilities/spacing.js +33 -0
  142. data/app/views/playbook/samples/dashboards/index.html.erb +3 -1
  143. data/lib/playbook/version.rb +1 -1
  144. data/lib/tasks/pb_release.rake +0 -2
  145. metadata +28 -6
@@ -4,7 +4,7 @@ import { Table, TableRow } from '../../'
4
4
  const TableSideHighlight = () => {
5
5
  return (
6
6
  <div>
7
- <Table size="md">
7
+ <Table size="sm">
8
8
  <thead>
9
9
  <tr>
10
10
  <th>{'Product colors'}</th>
@@ -15,22 +15,22 @@ const TableSideHighlight = () => {
15
15
  </tr>
16
16
  </thead>
17
17
  <tbody>
18
- <TableRow sideHighlightColor="windows">
19
- <td>{'Windows'}</td>
18
+ <TableRow sideHighlightColor="solar">
19
+ <td>{'Solar'}</td>
20
20
  <td>{'Value 2'}</td>
21
21
  <td>{'Value 3'}</td>
22
22
  <td>{'Value 4'}</td>
23
23
  <td>{'Value 5'}</td>
24
24
  </TableRow>
25
- <TableRow sideHighlightColor="siding">
26
- <td>{'Siding'}</td>
25
+ <TableRow sideHighlightColor="roofing">
26
+ <td>{'Roofing'}</td>
27
27
  <td>{'Value 2'}</td>
28
28
  <td>{'Value 3'}</td>
29
29
  <td>{'Value 4'}</td>
30
30
  <td>{'Value 5'}</td>
31
31
  </TableRow>
32
- <TableRow sideHighlightColor="doors">
33
- <td>{'Doors'}</td>
32
+ <TableRow sideHighlightColor="gutters">
33
+ <td>{'Gutters'}</td>
34
34
  <td>{'Value 2'}</td>
35
35
  <td>{'Value 3'}</td>
36
36
  <td>{'Value 4'}</td>
@@ -48,7 +48,7 @@ const TableSideHighlight = () => {
48
48
 
49
49
  <br />
50
50
 
51
- <Table size="md">
51
+ <Table size="sm">
52
52
  <thead>
53
53
  <tr>
54
54
  <th>{'Status colors'}</th>
@@ -89,6 +89,50 @@ const TableSideHighlight = () => {
89
89
  </TableRow>
90
90
  </tbody>
91
91
  </Table>
92
+
93
+ <br />
94
+
95
+ <Table size="sm">
96
+ <thead>
97
+ <tr>
98
+ <th>{'Category Colors'}</th>
99
+ <th>{'Column 2'}</th>
100
+ <th>{'Column 3'}</th>
101
+ <th>{'Column 4'}</th>
102
+ <th>{'Column 5'}</th>
103
+ </tr>
104
+ </thead>
105
+ <tbody>
106
+ <TableRow sideHighlightColor="category_1">
107
+ <td>{'Category Color 1'}</td>
108
+ <td>{'Value 2'}</td>
109
+ <td>{'Value 3'}</td>
110
+ <td>{'Value 4'}</td>
111
+ <td>{'Value 5'}</td>
112
+ </TableRow>
113
+ <TableRow sideHighlightColor="category_2">
114
+ <td>{'Category Color 2'}</td>
115
+ <td>{'Value 2'}</td>
116
+ <td>{'Value 3'}</td>
117
+ <td>{'Value 4'}</td>
118
+ <td>{'Value 5'}</td>
119
+ </TableRow>
120
+ <TableRow sideHighlightColor="category_3">
121
+ <td>{'Category Color 3'}</td>
122
+ <td>{'Value 2'}</td>
123
+ <td>{'Value 3'}</td>
124
+ <td>{'Value 4'}</td>
125
+ <td>{'Value 5'}</td>
126
+ </TableRow>
127
+ <TableRow sideHighlightColor="none">
128
+ <td>{'None'}</td>
129
+ <td>{'Value 2'}</td>
130
+ <td>{'Value 3'}</td>
131
+ <td>{'Value 4'}</td>
132
+ <td>{'Value 5'}</td>
133
+ </TableRow>
134
+ </tbody>
135
+ </Table>
92
136
  </div>
93
137
  )
94
138
  }
@@ -1 +1,3 @@
1
- Side highlight can pass status and product colors.
1
+ Side highlight can take product, status, and category colors. To view full list of colors, visit <a href="https://playbook.powerapp.cloud/utilities" target="_blank">token colors</a>.
2
+
3
+ Note: Only use category colors for categories. Do not mix it with product or status colors.
@@ -1,10 +1,8 @@
1
1
  /* @flow */
2
2
  import React from 'react'
3
3
  import classnames from 'classnames'
4
- import {
5
- Body,
6
- Caption,
7
- } from '../'
4
+ import { Body, Caption } from '../'
5
+ import { spacing } from '../utilities/spacing.js'
8
6
 
9
7
  import {
10
8
  buildAriaProps,
@@ -62,7 +60,7 @@ const TextInput = ({
62
60
  dark={dark}
63
61
  text={label}
64
62
  />
65
- <div className="text_input_wrapper">
63
+ <div className={classnames('text_input_wrapper', spacing(props))}>
66
64
  <If condition={children}>
67
65
  {children}
68
66
  <Else />
@@ -20,7 +20,7 @@ class TextInputDefault extends React.Component {
20
20
  return (
21
21
  <div>
22
22
  <TextInput
23
- aria={{ something: 'hello' }}
23
+ aria={{ label: 'hello' }}
24
24
  data={{ say: 'hi', yell: 'go' }}
25
25
  id="unique-id"
26
26
  label="First Name"
@@ -4,6 +4,7 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { Body, Caption } from '../'
6
6
  import type { InputCallback } from '../types.js'
7
+ import { spacing } from '../utilities/spacing.js'
7
8
 
8
9
  type TextareaProps = {
9
10
  className?: String,
@@ -42,7 +43,7 @@ const Textarea = ({
42
43
  const resizeClass = ` resize_${resize}`
43
44
 
44
45
  return (
45
- <div className={classnames(textareaClass, className, errorClass, resizeClass)}>
46
+ <div className={classnames(textareaClass, className, errorClass, resizeClass, spacing(props))}>
46
47
  <Caption
47
48
  dark={dark}
48
49
  text={label}
@@ -4,18 +4,19 @@ import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { Body, Caption, Icon } from '../'
6
6
  import DateTime from '../pb_kit/dateTime.js'
7
+ import { spacing } from '../utilities/spacing.js'
7
8
 
8
9
  type TimeRangeInlineProps = {
9
10
  className?: String,
10
11
  id?: String,
11
12
  data?: String,
12
- alignment?: 'left' | 'center' | 'vertical',
13
- size?: 'sm' | 'xs',
13
+ alignment?: "left" | "center" | "vertical",
14
+ size?: "sm" | "xs",
14
15
  dark?: Boolean,
15
16
  icon?: Boolean,
16
17
  timezone?: Boolean,
17
18
  startTime: String,
18
- endTime: String
19
+ endTime: String,
19
20
  }
20
21
 
21
22
  const timezoneString = (dateValue) => {
@@ -33,16 +34,17 @@ const dateTimeIso = (dateValue) => {
33
34
  return date.toIso()
34
35
  }
35
36
 
36
- const TimeRangeInline = ({
37
- className,
38
- alignment = 'left',
39
- size = 'sm',
40
- dark = false,
41
- icon = false,
42
- timezone = false,
43
- startTime,
44
- endTime,
45
- }: TimeRangeInlineProps) => {
37
+ const TimeRangeInline = (props: TimeRangeInlineProps) => {
38
+ const {
39
+ className,
40
+ alignment = 'left',
41
+ size = 'sm',
42
+ dark = false,
43
+ icon = false,
44
+ timezone = false,
45
+ startTime,
46
+ endTime,
47
+ } = props
46
48
  const separator = `${'—'}`
47
49
 
48
50
  const iconContent = () => {
@@ -61,7 +63,9 @@ const TimeRangeInline = ({
61
63
  }
62
64
 
63
65
  return (
64
- <div className={classnames('pb_time_range_inline_kit_' + alignment, className)}>
66
+ <div
67
+ className={classnames('pb_time_range_inline_kit_' + alignment, className, spacing(props))}
68
+ >
65
69
  <div className="pb_time_range_inline_wrapper">
66
70
  <If condition={size == 'xs'}>
67
71
  <Caption
@@ -69,7 +73,11 @@ const TimeRangeInline = ({
69
73
  tag="span"
70
74
  >
71
75
  {iconContent()}
72
- <time dateTime={dateTimeIso(startTime)}>{` ${dateTimestamp(startTime)} `}</time>
76
+ <time dateTime={dateTimeIso(startTime)}>
77
+ {` ${dateTimestamp(
78
+ startTime
79
+ )} `}
80
+ </time>
73
81
  </Caption>
74
82
  <Caption
75
83
  className="pb_time_range_inline_dash"
@@ -82,7 +90,11 @@ const TimeRangeInline = ({
82
90
  dark={dark}
83
91
  tag="span"
84
92
  >
85
- <time dateTime={dateTimeIso(endTime)}>{` ${dateTimestamp(endTime)} `}</time>
93
+ <time dateTime={dateTimeIso(endTime)}>
94
+ {` ${dateTimestamp(
95
+ endTime
96
+ )} `}
97
+ </time>
86
98
  </Caption>
87
99
  <If condition={timezone}>
88
100
  <Caption
@@ -100,7 +112,11 @@ const TimeRangeInline = ({
100
112
  tag="span"
101
113
  >
102
114
  {iconContent()}
103
- <time dateTime={dateTimeIso(startTime)}>{` ${dateTimestamp(startTime)} `}</time>
115
+ <time dateTime={dateTimeIso(startTime)}>
116
+ {` ${dateTimestamp(
117
+ startTime
118
+ )} `}
119
+ </time>
104
120
  </Body>
105
121
  <Body
106
122
  className="pb_time_range_inline_dash"
@@ -113,7 +129,11 @@ const TimeRangeInline = ({
113
129
  dark={dark}
114
130
  tag="span"
115
131
  >
116
- <time dateTime={dateTimeIso(endTime)}>{` ${dateTimestamp(endTime)} `}</time>
132
+ <time dateTime={dateTimeIso(endTime)}>
133
+ {` ${dateTimestamp(
134
+ endTime
135
+ )} `}
136
+ </time>
117
137
  </Body>
118
138
  <If condition={timezone}>
119
139
  <Body
@@ -6,6 +6,7 @@ import classnames from 'classnames'
6
6
  import DateTime from '../pb_kit/dateTime.js'
7
7
  import { buildCss } from '../utilities/props'
8
8
  import { Body, Caption } from '../'
9
+ import { spacing } from '../utilities/spacing.js'
9
10
 
10
11
  const Components = {
11
12
  body: Body,
@@ -18,19 +19,19 @@ type TimeStackedProps = {
18
19
  data?: String,
19
20
  date: String,
20
21
  id?: String,
21
- align?: 'left' | 'center' | 'right',
22
- tag?: 'body' | 'caption',
22
+ align?: "left" | "center" | "right",
23
+ tag?: "body" | "caption",
23
24
  }
24
25
 
25
- const TimeStacked = ({
26
- className,
27
- dark = false,
28
- date,
29
- tag = 'body',
30
- }: TimeStackedProps) => {
31
- const classes = classnames(className, buildCss('pb_time_stacked_kit', {
32
- 'dark': dark,
33
- }))
26
+ const TimeStacked = (props: TimeStackedProps) => {
27
+ const { className, dark = false, date, tag = 'body' } = props
28
+ const classes = classnames(
29
+ className,
30
+ buildCss('pb_time_stacked_kit', {
31
+ dark: dark,
32
+ }),
33
+ spacing(props)
34
+ )
34
35
 
35
36
  const tagClasses = classnames(buildCss('pb_time_stacked_kit', tag))
36
37
 
@@ -3,14 +3,11 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
 
6
- import {
7
- Caption,
8
- } from '../'
6
+ import { Caption } from '../'
9
7
 
10
- import {
11
- buildCss,
12
- buildDataProps,
13
- } from '../utilities/props'
8
+ import { buildCss, buildDataProps } from '../utilities/props'
9
+
10
+ import { spacing } from '../utilities/spacing.js'
14
11
 
15
12
  type TimestampProps = {
16
13
  id?: String,
@@ -19,19 +16,15 @@ type TimestampProps = {
19
16
  text?: String,
20
17
  }
21
18
 
22
- const Timestamp = ({
23
- id,
24
- className,
25
- data = {},
26
- text,
27
- }: TimestampProps) => {
19
+ const Timestamp = (props: TimestampProps) => {
20
+ const { id, className, data = {}, text } = props
28
21
  const dataProps = buildDataProps(data)
29
22
  const pbCss = buildCss('pb_timestamp_kit')
30
23
 
31
24
  return (
32
25
  <div
33
26
  {...dataProps}
34
- className={classnames(className, pbCss)}
27
+ className={classnames(className, pbCss, spacing(props))}
35
28
  id={id}
36
29
  >
37
30
  <Caption
@@ -2,6 +2,7 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
+ import { spacing } from '../utilities/spacing.js'
5
6
 
6
7
  type TitleProps = {
7
8
  className?: String,
@@ -9,13 +10,10 @@ type TitleProps = {
9
10
  dark?: Boolean,
10
11
  size?: 1 | 2 | 3 | 4,
11
12
  text?: String,
12
- tag?: 'h1' | 'h2' | 'h3',
13
+ tag?: "h1" | "h2" | "h3",
13
14
  }
14
15
 
15
- const tagCSS = ({
16
- dark = false,
17
- size = 3,
18
- }) => {
16
+ const tagCSS = ({ dark = false, size = 3 }) => {
19
17
  let css = ''
20
18
 
21
19
  css += `_${size}`
@@ -25,18 +23,19 @@ const tagCSS = ({
25
23
  }
26
24
 
27
25
  const Title = (props: TitleProps) => {
28
- const {
29
- className,
30
- children,
31
- text,
32
- tag = 'h3',
33
- } = props
26
+ const { children, className, tag = 'h3', text } = props
34
27
 
35
28
  const Tag = `${tag}`
36
29
 
37
30
  return (
38
- <Tag className={classnames(`pb_title_kit${tagCSS(props)}`, className)}>
39
- { text || children }
31
+ <Tag
32
+ className={classnames(
33
+ `pb_title_kit${tagCSS(props)}`,
34
+ className,
35
+ spacing(props),
36
+ )}
37
+ >
38
+ {text || children}
40
39
  </Tag>
41
40
  )
42
41
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  <br/>
4
4
 
5
- <%= pb_rails("title", props: { text: "Title 4", tag: "h4", size: 4 }) %>
5
+ <%= pb_rails("title", props: { text: "Title 4", tag: "h4", size: 4 }) %>
6
6
  <%= pb_rails("title", props: { text: "Title 3", tag: "h3", size: 3 }) %>
7
7
  <%= pb_rails("title", props: { text: "Title 2", tag: "h2", size: 2 }) %>
8
8
  <%= pb_rails("title", props: { text: "Title 1", tag: "h1", size: 1 }) %>
@@ -1,39 +1,60 @@
1
1
  /* @flow */
2
+
2
3
  import React from 'react'
4
+ import classnames from 'classnames'
5
+
6
+ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
+
3
8
  import { Body, Title } from '../'
9
+ import { spacing } from '../utilities/spacing.js'
4
10
 
5
11
  type TitleCountProps = {
12
+ align: "center" | "left" | "right",
13
+ aria?: object,
6
14
  className?: String,
7
- data?: String,
15
+ count?: Numeric,
16
+ data?: object,
8
17
  id?: String,
9
18
  title?: String,
10
- count?: Number,
11
- size?: String
12
- }
19
+ size?: "lg" | "sm",
20
+ };
21
+
22
+ const TitleCount = (props: TitleCountProps) => {
23
+ const {
24
+ align = 'left',
25
+ aria = {},
26
+ className,
27
+ data = {},
28
+ count,
29
+ id,
30
+ title,
31
+ size = 'sm' } = props
32
+ const ariaProps = buildAriaProps(aria)
33
+ const dataProps = buildDataProps(data)
13
34
 
14
- const TitleCount = ({
15
- className = 'pb_title_count_kit',
16
- data,
17
- count,
18
- id,
19
- title,
20
- size,
21
- }: TitleCountProps) => (
22
- <div
23
- className={className}
24
- data={data}
25
- id={id}
26
- >
27
- <Title
28
- className="pb_title_count_text"
29
- size={size == 'lg' ? 3 : 4}
30
- text={title}
31
- />
32
- <Body
33
- color="light"
34
- text={`${count}`}
35
- />
36
- </div>
37
- )
35
+ const css = classnames(buildCss('pb_title_count_kit', align, size), className, spacing(props))
36
+
37
+ const formatCount = count.toLocaleString()
38
+
39
+ return (
40
+ <div
41
+ {...ariaProps}
42
+ {...dataProps}
43
+ className={css}
44
+ id={id}
45
+ >
46
+ <Title
47
+ className={title !== undefined ? 'pb_title_count_text' : ''}
48
+ size={size === 'lg' ? 3 : 4}
49
+ text={title}
50
+ />
51
+
52
+ <Body color="light">
53
+ <If condition={count}>{formatCount}</If>
54
+ </Body>
55
+
56
+ </div>
57
+ )
58
+ }
38
59
 
39
60
  export default TitleCount