playbook_ui 7.6.1 → 7.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/{sample_screenshot.svg → full_page_samples.svg} +0 -0
- data/app/pb_kits/playbook/_playbook.scss +3 -1
- data/app/pb_kits/playbook/data/menu.yml +3 -0
- data/app/pb_kits/playbook/index.js +4 -1
- data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +1 -1
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +0 -2
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +27 -0
- data/app/pb_kits/playbook/pb_background/_background.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/_button.scss +0 -1
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.jsx +8 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +9 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.jsx +17 -6
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx +15 -5
- data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx +2 -1
- data/app/pb_kits/playbook/pb_filter/Filter/ResultsCount.jsx +4 -1
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.jsx +9 -4
- data/app/pb_kits/playbook/pb_filter/Filter/index.jsx +0 -1
- data/app/pb_kits/playbook/pb_filter/_filter.scss +44 -23
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +3 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +5 -4
- data/app/pb_kits/playbook/pb_filter/docs/_filter_no_background.html.erb +6 -4
- data/app/pb_kits/playbook/pb_filter/docs/_filter_no_background.jsx +73 -28
- data/app/pb_kits/playbook/pb_filter/docs/_filter_only.jsx +3 -7
- data/app/pb_kits/playbook/pb_filter/docs/_filter_single.jsx +4 -3
- data/app/pb_kits/playbook/pb_filter/docs/_sort_only.html.erb +1 -2
- data/app/pb_kits/playbook/pb_filter/docs/_sort_only.jsx +3 -3
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +4 -5
- data/app/pb_kits/playbook/pb_form_group/_form_group.html.erb +7 -0
- data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +41 -0
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +123 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_button.html.erb +12 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_button.jsx +39 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_date_picker.html.erb +6 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_date_picker.jsx +21 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_default.html.erb +7 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_default.jsx +26 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.html.erb +19 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_select.jsx +35 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_selectable_card.html.erb +21 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_selectable_card.jsx +42 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_selectable_card_icon.html.erb +19 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_selectable_card_icon.jsx +35 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_typeahead.html.erb +42 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_typeahead.jsx +31 -0
- data/app/pb_kits/playbook/pb_form_group/docs/example.yml +20 -0
- data/app/pb_kits/playbook/pb_form_group/docs/index.js +7 -0
- data/app/pb_kits/playbook/pb_form_group/form_group.rb +15 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.html.erb +24 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.jsx +105 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.scss +64 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.html.erb +49 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.jsx +67 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_default.html.erb +11 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_default.jsx +25 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_sizes.html.erb +20 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_sizes.jsx +35 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_vertical.html.erb +7 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_vertical.jsx +19 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/example.yml +15 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +52 -0
- data/app/pb_kits/playbook/pb_image/_image.scss +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.jsx +2 -2
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_status.jsx +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.html.erb +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +123 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +216 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +10 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +3 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.jsx +11 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.jsx +10 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.jsx +14 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.html.erb +115 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_templates.jsx +39 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +15 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/templates.js +75 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +55 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/useFocus.js +20 -0
- data/app/pb_kits/playbook/pb_table/_table.scss +45 -13
- data/app/pb_kits/playbook/pb_table/docs/_description.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.jsx +43 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.html.erb +34 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.jsx +43 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.html.erb +63 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.jsx +70 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.md +2 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.html.erb +52 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.jsx +61 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +9 -1
- data/app/pb_kits/playbook/pb_table/docs/index.js +4 -1
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.html.erb +3 -6
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +15 -21
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.scss +0 -17
- data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.html.erb +4 -1
- data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.jsx +12 -1
- data/app/pb_kits/playbook/pb_time_stacked/docs/example.yml +1 -4
- data/app/pb_kits/playbook/pb_time_stacked/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_time_stacked/time_stacked.rb +7 -11
- data/app/pb_kits/playbook/react_rails_kits.js +1 -0
- data/app/pb_kits/playbook/utilities/globalProps.js +9 -0
- data/app/pb_kits/playbook/utilities/test-utils.js +24 -0
- data/app/pb_kits/playbook/vendor.js +2 -0
- data/lib/playbook/version.rb +1 -1
- metadata +72 -10
- data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_caption.html.erb +0 -2
- data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_caption.jsx +0 -15
@@ -0,0 +1,105 @@
|
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import classnames from 'classnames'
|
5
|
+
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
+
import { Body, Caption, Flex, IconCircle, Title } from '../'
|
7
|
+
import { globalProps } from '../utilities/globalProps.js'
|
8
|
+
|
9
|
+
type IconStatValueProps = {
|
10
|
+
aria?: object,
|
11
|
+
className?: string,
|
12
|
+
data?: object,
|
13
|
+
icon: string,
|
14
|
+
id?: string,
|
15
|
+
orientation?: "vertical" | "horizontal",
|
16
|
+
size?: "sm" | "md" | "lg",
|
17
|
+
text?: string,
|
18
|
+
unit?: string,
|
19
|
+
value: number,
|
20
|
+
variant?: "default"
|
21
|
+
| "royal"
|
22
|
+
| "blue"
|
23
|
+
| "purple"
|
24
|
+
| "teal"
|
25
|
+
| "red"
|
26
|
+
| "yellow"
|
27
|
+
| "green",
|
28
|
+
}
|
29
|
+
|
30
|
+
const IconStatValue = (props: IconStatValueProps) => {
|
31
|
+
const {
|
32
|
+
aria = {},
|
33
|
+
className,
|
34
|
+
data = {},
|
35
|
+
icon,
|
36
|
+
id,
|
37
|
+
orientation = 'horizontal',
|
38
|
+
size = 'sm',
|
39
|
+
text = '',
|
40
|
+
unit = '',
|
41
|
+
value = 0,
|
42
|
+
variant = 'default',
|
43
|
+
} = props
|
44
|
+
const ariaProps = buildAriaProps(aria)
|
45
|
+
const dataProps = buildDataProps(data)
|
46
|
+
const classes = classnames(
|
47
|
+
buildCss('pb_icon_stat_value_kit', orientation, size, variant), globalProps(props),
|
48
|
+
className
|
49
|
+
)
|
50
|
+
const titleSize = function(size) {
|
51
|
+
if (size == 'lg') {
|
52
|
+
return (
|
53
|
+
<Title
|
54
|
+
size={1}
|
55
|
+
text={`${value}`}
|
56
|
+
/>
|
57
|
+
)
|
58
|
+
} else if (size == 'md') {
|
59
|
+
return (
|
60
|
+
<Title
|
61
|
+
size={2}
|
62
|
+
text={`${value}`}
|
63
|
+
/>
|
64
|
+
)
|
65
|
+
} else {
|
66
|
+
return (
|
67
|
+
<Title
|
68
|
+
size={3}
|
69
|
+
text={`${value}`}
|
70
|
+
/>
|
71
|
+
)
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
return (
|
76
|
+
<div
|
77
|
+
{...ariaProps}
|
78
|
+
{...dataProps}
|
79
|
+
className={classes}
|
80
|
+
id={id}
|
81
|
+
>
|
82
|
+
<IconCircle
|
83
|
+
icon={icon}
|
84
|
+
size={size}
|
85
|
+
variant={variant}
|
86
|
+
/>
|
87
|
+
|
88
|
+
<div>
|
89
|
+
<Flex
|
90
|
+
vertical="bottom"
|
91
|
+
>
|
92
|
+
{titleSize(size)}
|
93
|
+
|
94
|
+
<Body
|
95
|
+
text={unit}
|
96
|
+
/>
|
97
|
+
</Flex>
|
98
|
+
<Caption text={text} />
|
99
|
+
</div>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
)
|
103
|
+
}
|
104
|
+
|
105
|
+
export default IconStatValue
|
@@ -0,0 +1,64 @@
|
|
1
|
+
@import "../pb_title/title";
|
2
|
+
@import "../pb_caption/caption";
|
3
|
+
@import "../tokens/spacing";
|
4
|
+
@import "../pb_icon_circle/icon_circle";
|
5
|
+
|
6
|
+
[class^=pb_icon_stat_value_kit]{
|
7
|
+
display: flex;
|
8
|
+
align-items: baseline;
|
9
|
+
|
10
|
+
&[class*=_vertical] {
|
11
|
+
flex-direction: column;
|
12
|
+
|
13
|
+
&[class*=_center] {
|
14
|
+
align-items: center;
|
15
|
+
|
16
|
+
[class^=pb_title],
|
17
|
+
[class^=pb_body],
|
18
|
+
[class^=pb_caption] {
|
19
|
+
text-align: center;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
&[class*=_right] {
|
24
|
+
align-items: flex-end;
|
25
|
+
|
26
|
+
[class^=pb_title],
|
27
|
+
[class^=pb_body],
|
28
|
+
[class^=pb_caption] {
|
29
|
+
text-align: right;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
[class^=pb_icon_circle] {
|
34
|
+
margin-bottom: $space-xs;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
&[class*=_horizontal] {
|
39
|
+
align-items: center;
|
40
|
+
|
41
|
+
&[class*=_center] {
|
42
|
+
justify-content: center;
|
43
|
+
}
|
44
|
+
|
45
|
+
&[class*=_right] {
|
46
|
+
justify-content: flex-end;
|
47
|
+
}
|
48
|
+
|
49
|
+
[class^=pb_icon_circle] {
|
50
|
+
margin-right: $space-sm;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
[class^=pb_title_kit_1] + [class^=pb_body_kit] {
|
54
|
+
font-size: 36px;
|
55
|
+
}
|
56
|
+
|
57
|
+
[class^=pb_title_kit_2] + [class^=pb_body_kit] {
|
58
|
+
font-size: 24px
|
59
|
+
}
|
60
|
+
|
61
|
+
[class^=pb_title_kit_3] + [class^=pb_body_kit] {
|
62
|
+
font-size: 20px;
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
<%= pb_rails("icon_stat_value", props: { icon: "globe-europe",
|
3
|
+
text: "Mercury",
|
4
|
+
unit: "AU",
|
5
|
+
value: 0.39,
|
6
|
+
variant:"blue"
|
7
|
+
}) %>
|
8
|
+
<br>
|
9
|
+
<%= pb_rails("icon_stat_value", props: { icon: "planet-ringed",
|
10
|
+
text: "Venus",
|
11
|
+
unit: "AU",
|
12
|
+
value: 0.723,
|
13
|
+
variant:"royal"
|
14
|
+
}) %>
|
15
|
+
<br>
|
16
|
+
<%= pb_rails("icon_stat_value", props: { icon: "planet-moon",
|
17
|
+
text: "Earth",
|
18
|
+
unit: "AU",
|
19
|
+
value: 1.0,
|
20
|
+
variant:"purple"
|
21
|
+
}) %>
|
22
|
+
<br>
|
23
|
+
<%= pb_rails("icon_stat_value", props: { icon: "solar-system",
|
24
|
+
text: "Mars",
|
25
|
+
unit: "AU",
|
26
|
+
value: 1.524,
|
27
|
+
variant:"teal"
|
28
|
+
}) %>
|
29
|
+
<br>
|
30
|
+
<%= pb_rails("icon_stat_value", props: { icon: "globe-americas",
|
31
|
+
text: "Jupitar",
|
32
|
+
unit: "AU",
|
33
|
+
value: 5.203,
|
34
|
+
variant:"red"
|
35
|
+
}) %>
|
36
|
+
<br>
|
37
|
+
<%= pb_rails("icon_stat_value", props: { icon: "globe-africa",
|
38
|
+
text: "Saturn",
|
39
|
+
unit: "AU",
|
40
|
+
value: 9.539,
|
41
|
+
variant:"yellow"
|
42
|
+
}) %>
|
43
|
+
<br>
|
44
|
+
<%= pb_rails("icon_stat_value", props: { icon: "globe",
|
45
|
+
text: "Uranus",
|
46
|
+
unit: "AU",
|
47
|
+
value: 19.18,
|
48
|
+
variant:"green"
|
49
|
+
}) %>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { IconStatValue } from '../../'
|
3
|
+
|
4
|
+
const IconStatValueColor = () => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<IconStatValue
|
8
|
+
icon="globe-europe"
|
9
|
+
text="Mercury"
|
10
|
+
unit="AU"
|
11
|
+
value={0.39}
|
12
|
+
variant="blue"
|
13
|
+
/>
|
14
|
+
<br />
|
15
|
+
<IconStatValue
|
16
|
+
icon="planet-ringed"
|
17
|
+
text="Venus"
|
18
|
+
unit="AU"
|
19
|
+
value={0.723}
|
20
|
+
variant="royal"
|
21
|
+
/>
|
22
|
+
<br />
|
23
|
+
<IconStatValue
|
24
|
+
icon="planet-moon"
|
25
|
+
text="Earth"
|
26
|
+
unit="AU"
|
27
|
+
value={1.0}
|
28
|
+
variant="purple"
|
29
|
+
/>
|
30
|
+
<br />
|
31
|
+
<IconStatValue
|
32
|
+
icon="solar-system"
|
33
|
+
text="Mars"
|
34
|
+
unit="AU"
|
35
|
+
value={1.524}
|
36
|
+
variant="teal"
|
37
|
+
/>
|
38
|
+
<br />
|
39
|
+
<IconStatValue
|
40
|
+
icon="globe-americas"
|
41
|
+
text="Jupitar"
|
42
|
+
unit="AU"
|
43
|
+
value={5.203}
|
44
|
+
variant="red"
|
45
|
+
/>
|
46
|
+
<br />
|
47
|
+
<IconStatValue
|
48
|
+
icon="globe-africa"
|
49
|
+
text="Saturn"
|
50
|
+
unit="AU"
|
51
|
+
value={9.539}
|
52
|
+
variant="yellow"
|
53
|
+
/>
|
54
|
+
<br />
|
55
|
+
<IconStatValue
|
56
|
+
icon="globe"
|
57
|
+
text="Uranus"
|
58
|
+
unit="AU"
|
59
|
+
value={19.18}
|
60
|
+
variant="green"
|
61
|
+
/>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
)
|
65
|
+
}
|
66
|
+
|
67
|
+
export default IconStatValueColor
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { IconStatValue } from '../../'
|
3
|
+
|
4
|
+
const IconStatValueDefault = () => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<IconStatValue
|
8
|
+
icon="lightbulb-on"
|
9
|
+
text="Electric"
|
10
|
+
unit="kw"
|
11
|
+
value={64.18}
|
12
|
+
/>
|
13
|
+
<br />
|
14
|
+
<IconStatValue
|
15
|
+
icon="calendar"
|
16
|
+
text="deadline"
|
17
|
+
unit="days"
|
18
|
+
value={24}
|
19
|
+
/>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
)
|
23
|
+
}
|
24
|
+
|
25
|
+
export default IconStatValueDefault
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= pb_rails("icon_stat_value", props: { icon: "car",
|
2
|
+
size: "sm",
|
3
|
+
text: "distance driven",
|
4
|
+
unit: " mi",
|
5
|
+
value: 158.3
|
6
|
+
}) %>
|
7
|
+
<br>
|
8
|
+
<%= pb_rails("icon_stat_value", props: { icon: "car",
|
9
|
+
size: "md",
|
10
|
+
text: "distance driven",
|
11
|
+
unit: " mi",
|
12
|
+
value: 158.3
|
13
|
+
}) %>
|
14
|
+
<br>
|
15
|
+
<%= pb_rails("icon_stat_value", props: { icon: "car",
|
16
|
+
size: "lg",
|
17
|
+
text: "distance driven",
|
18
|
+
unit: " mi",
|
19
|
+
value: 158.3
|
20
|
+
}) %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { IconStatValue } from '../../'
|
3
|
+
|
4
|
+
const IconStatValueSizes = () => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<IconStatValue
|
8
|
+
icon="car"
|
9
|
+
size="sm"
|
10
|
+
text="distance driven"
|
11
|
+
unit="mi"
|
12
|
+
value={158.3}
|
13
|
+
/>
|
14
|
+
<br />
|
15
|
+
<IconStatValue
|
16
|
+
icon="car"
|
17
|
+
size="md"
|
18
|
+
text="distance driven"
|
19
|
+
unit="mi"
|
20
|
+
value={158.3}
|
21
|
+
/>
|
22
|
+
<br />
|
23
|
+
<IconStatValue
|
24
|
+
icon="car"
|
25
|
+
size="lg"
|
26
|
+
text="distance driven"
|
27
|
+
unit="mi"
|
28
|
+
value={158.3}
|
29
|
+
/>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
)
|
33
|
+
}
|
34
|
+
|
35
|
+
export default IconStatValueSizes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { IconStatValue } from '../../'
|
3
|
+
|
4
|
+
const IconStatValueVertical = () => {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<IconStatValue
|
8
|
+
icon="broadcast-tower"
|
9
|
+
orientation="vertical"
|
10
|
+
text="Radio"
|
11
|
+
unit="wkz"
|
12
|
+
value={102.5}
|
13
|
+
/>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
)
|
17
|
+
}
|
18
|
+
|
19
|
+
export default IconStatValueVertical
|
@@ -0,0 +1,15 @@
|
|
1
|
+
examples:
|
2
|
+
|
3
|
+
rails:
|
4
|
+
- icon_stat_value_default: Default
|
5
|
+
- icon_stat_value_sizes: Size
|
6
|
+
- icon_stat_value_vertical: Vertical
|
7
|
+
- icon_stat_value_color: Color
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
react:
|
12
|
+
- icon_stat_value_default: Default
|
13
|
+
- icon_stat_value_sizes: Size
|
14
|
+
- icon_stat_value_vertical: Vertical
|
15
|
+
- icon_stat_value_color: Color
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export { default as IconStatValueDefault } from './_icon_stat_value_default.jsx'
|
2
|
+
export { default as IconStatValueSizes } from './_icon_stat_value_sizes.jsx'
|
3
|
+
export { default as IconStatValueVertical } from './_icon_stat_value_vertical.jsx'
|
4
|
+
export { default as IconStatValueColor } from './_icon_stat_value_color.jsx'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbIconStatValue
|
5
|
+
class IconStatValue
|
6
|
+
include Playbook::Props
|
7
|
+
include ActionView::Helpers::NumberHelper
|
8
|
+
|
9
|
+
partial "pb_icon_stat_value/icon_stat_value"
|
10
|
+
|
11
|
+
prop :icon, required: true
|
12
|
+
|
13
|
+
prop :size, type: Playbook::Props::Enum,
|
14
|
+
values: %w[sm md lg],
|
15
|
+
default: "sm"
|
16
|
+
prop :variant, type: Playbook::Props::Enum,
|
17
|
+
values: %w[default royal blue purple teal red yellow green],
|
18
|
+
default: "default"
|
19
|
+
|
20
|
+
prop :orientation, type: Playbook::Props::Enum,
|
21
|
+
values: %w[vertical horizontal],
|
22
|
+
default: "horizontal"
|
23
|
+
|
24
|
+
prop :unit, type: Playbook::Props::String,
|
25
|
+
default: ""
|
26
|
+
|
27
|
+
prop :text, type: Playbook::Props::String,
|
28
|
+
default: ""
|
29
|
+
|
30
|
+
prop :value, type: Playbook::Props::Numeric
|
31
|
+
|
32
|
+
|
33
|
+
def classname
|
34
|
+
generate_classname("pb_icon_stat_value_kit", orientation, size, variant)
|
35
|
+
end
|
36
|
+
|
37
|
+
def value_string
|
38
|
+
value.to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
def title_size
|
42
|
+
if size == "lg"
|
43
|
+
1
|
44
|
+
elsif size == "md"
|
45
|
+
2
|
46
|
+
else
|
47
|
+
3
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|