playbook_ui 12.38.0 → 12.39.0.pre.alpha.salesbookmismatchingdate1114
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.scss +6 -0
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +3 -3
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +10 -9
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +4 -8
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +75 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +3 -0
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -6
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_kit/dateTime.ts +41 -36
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +280 -17
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +6 -0
- data/app/pb_kits/playbook/pb_nav/_item.tsx +35 -22
- data/app/pb_kits/playbook/pb_nav/_mixins.scss +5 -0
- data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -7
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +85 -58
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +58 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +23 -0
- data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_custom_icons.jsx → _collapsible_nav_emphasize.jsx} +14 -5
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -3
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +5 -4
- data/app/pb_kits/playbook/pb_nav/item.rb +29 -3
- data/app/pb_kits/playbook/pb_select/_select.scss +76 -0
- data/app/pb_kits/playbook/pb_select/_select.tsx +9 -5
- data/app/pb_kits/playbook/pb_select/docs/_select_attributes.html.erb +26 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_attributes.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_multiple.html.erb +36 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_multiple.jsx +50 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_multiple.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +3 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_select/select.html.erb +5 -9
- data/app/pb_kits/playbook/pb_select/select.rb +14 -0
- data/app/pb_kits/playbook/pb_select/select.test.js +17 -0
- data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
- data/dist/playbook-rails.js +2 -2
- data/lib/playbook/version.rb +2 -2
- metadata +21 -8
@@ -1,27 +1,290 @@
|
|
1
1
|
@import "../tokens/spacing";
|
2
2
|
@import "../tokens/colors";
|
3
3
|
@import "../tokens/border_radius";
|
4
|
+
@import "../tokens/titles";
|
5
|
+
@import "../tokens/typography";
|
6
|
+
@import "./mixins";
|
4
7
|
|
5
8
|
[class^="pb_nav_list"] {
|
6
|
-
.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
}
|
12
|
-
|
13
|
-
.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
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;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
.font_regular {
|
40
|
+
.pb_nav_list_item_text {
|
41
|
+
font-weight: $regular;
|
42
|
+
}
|
43
|
+
.pb_collapsible_main_kit {
|
44
|
+
.pb_nav_list_item_text_collapsible {
|
45
|
+
font-weight: $regular !important;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
//styling for default variant with collapsible
|
51
|
+
&[class*="_normal"] {
|
52
|
+
[class*="pb_collapsible_nav_item"] {
|
53
|
+
.pb_collapsible_content_kit {
|
54
|
+
margin-left: $space_lg + 3;
|
55
|
+
}
|
56
|
+
.pb_collapsible_main_kit {
|
57
|
+
border-radius: unset;
|
58
|
+
}
|
59
|
+
&[class*="_active"] {
|
60
|
+
.pb_collapsible_main_kit {
|
61
|
+
background-color: $active_light;
|
62
|
+
}
|
63
|
+
.pb_nav_list_item_link {
|
64
|
+
border-color: transparent !important;
|
65
|
+
.pb_nav_list_item_text {
|
66
|
+
color: unset !important;
|
67
|
+
font-weight: $regular !important;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
&.dark {
|
73
|
+
border-color: $border_dark;
|
74
|
+
.pb_collapsible_main_kit:hover {
|
75
|
+
.pb_nav_list_item_text_collapsible {
|
76
|
+
color: $white !important;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
&[class*="_active"] {
|
80
|
+
.pb_collapsible_main_kit {
|
81
|
+
background-color: mix($white, $card_dark, 20%);
|
82
|
+
.pb_nav_list_item_text_collapsible,
|
83
|
+
svg {
|
84
|
+
color: $white !important;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
//styling bold variant to work with collapsible
|
93
|
+
&[class*="_bold"] {
|
94
|
+
[class*="pb_collapsible_nav_item"] {
|
95
|
+
&[class*="_active"] {
|
96
|
+
.pb_collapsible_main_kit {
|
97
|
+
background-color: $primary !important;
|
98
|
+
border-radius: $border_rad_heavier;
|
99
|
+
.pb_nav_list_item_text_collapsible,
|
100
|
+
.pb_nav_list_item_icon_collapsible,
|
101
|
+
.icon_wrapper,
|
102
|
+
.pb_icon_kit {
|
103
|
+
color: $white !important;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
.pb_nav_list_item_link {
|
107
|
+
background-color: unset !important;
|
108
|
+
box-shadow: unset !important;
|
109
|
+
&:hover {
|
110
|
+
background-color: rgba($primary, 0.03) !important;
|
111
|
+
.pb_nav_list_item_text {
|
112
|
+
color: $primary !important;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
.pb_nav_list_item_text {
|
116
|
+
font-weight: $regular !important;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
//styling for subtle variant with collapsible
|
124
|
+
&[class*="_subtle"] {
|
125
|
+
[class*="pb_collapsible_nav_item"] {
|
126
|
+
&[class*="_active"] {
|
127
|
+
.pb_collapsible_main_kit {
|
128
|
+
background-color: $primary !important;
|
129
|
+
border-radius: $border_rad_heavier;
|
130
|
+
.pb_nav_list_item_text_collapsible,
|
131
|
+
.pb_nav_list_item_icon_collapsible,
|
132
|
+
.icon_wrapper,
|
133
|
+
.pb_icon_kit {
|
134
|
+
color: $white !important;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
&:hover {
|
139
|
+
background-color: unset;
|
140
|
+
}
|
141
|
+
.pb_collapsible_main_kit:hover {
|
142
|
+
.pb_nav_list_item_text_collapsible {
|
143
|
+
color: $white !important;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
.icon_wrapper {
|
148
|
+
&:hover {
|
149
|
+
background-color: mix($primary, $card_light, 40%);
|
150
|
+
.pb_icon_kit {
|
151
|
+
color: $primary !important;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
[class*="pb_collapsible_nav_item"] {
|
160
|
+
.pb_nav_list_kit_item {
|
161
|
+
margin-right: 0px !important;
|
162
|
+
}
|
163
|
+
|
164
|
+
&[class*="_active"] {
|
165
|
+
background-color: unset !important;
|
166
|
+
.pb_nav_list_item_link {
|
167
|
+
color: unset !important;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
.pb_nav_list_item_link_collapsible {
|
172
|
+
&:focus-visible {
|
173
|
+
outline: none;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
.pb_collapsible_main_kit {
|
178
|
+
&:focus-visible {
|
179
|
+
box-shadow: 0px 0px 0px 2px $primary_action;
|
180
|
+
border-radius: $border_rad_heavier;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
//Make sure link is entire width of navitem when in collapsible
|
185
|
+
.pb_collapsible_main_kit {
|
186
|
+
.pb_flex_item_kit:first-child {
|
187
|
+
width: 100%;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
21
191
|
&:hover {
|
22
|
-
|
192
|
+
.pb_nav_list_item_link_collapsible {
|
193
|
+
background-color: unset !important;
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
// vertical line on left of collapsible content
|
198
|
+
.pb_collapsible_content_kit {
|
199
|
+
margin-left: $space_sm + 2;
|
200
|
+
border-left: 1px solid transparent;
|
201
|
+
}
|
202
|
+
|
203
|
+
.pb_collapsible_main_kit {
|
204
|
+
transition-property: color, border-color, background-color;
|
205
|
+
transition-duration: 0.15s;
|
206
|
+
transition-timing-function: $bezier;
|
207
|
+
border-radius: $border_rad_heavier;
|
208
|
+
&:hover {
|
209
|
+
background-color: mix($primary, $card_light, 10%);
|
210
|
+
.pb_nav_list_item_text_collapsible,
|
211
|
+
svg {
|
212
|
+
color: $primary !important;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
.pb_collapsible_main_kit,
|
218
|
+
.pb_collapsible_content_kit,
|
219
|
+
.pb_collapsible_kit {
|
220
|
+
padding: 0 !important;
|
221
|
+
}
|
222
|
+
|
223
|
+
&[class*="_collapsible_trail"] {
|
224
|
+
@include collapsible_trail_class;
|
225
|
+
}
|
23
226
|
|
227
|
+
.icon_wrapper {
|
228
|
+
border-radius: $border_radius_rounded;
|
229
|
+
width: $space_sm + 3;
|
230
|
+
height: $space_sm + 3;
|
231
|
+
display: flex;
|
232
|
+
align-items: center;
|
233
|
+
justify-content: center;
|
234
|
+
margin-right: $space_xs;
|
235
|
+
&:hover {
|
236
|
+
background-color: mix($primary, $card_light, 40%);
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
&.dark {
|
241
|
+
.pb_nav_list_kit_item {
|
242
|
+
border-color: $border_dark;
|
243
|
+
.pb_nav_list_item_text {
|
244
|
+
color: $text_dk_light !important;
|
245
|
+
}
|
246
|
+
}
|
247
|
+
&[class*="pb_nav_list_kit_item"] [class*="_link"]:hover {
|
248
|
+
.pb_nav_list_item_text {
|
249
|
+
color: $white !important;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
.pb_nav_list_item_text_collapsible {
|
254
|
+
color: $white !important;
|
255
|
+
}
|
256
|
+
.pb_nav_list_item_text {
|
257
|
+
color: $text_dk_light;
|
258
|
+
}
|
259
|
+
.pb_nav_list_kit_item:hover {
|
260
|
+
background-color: #ffffff33;
|
261
|
+
color: $white;
|
262
|
+
}
|
263
|
+
.pb_icon_kit {
|
264
|
+
color: $text_dk_light;
|
265
|
+
}
|
266
|
+
|
267
|
+
.pb_collapsible_main_kit:hover {
|
268
|
+
background-color: mix($white, $card_dark, 20%);
|
269
|
+
.pb_nav_list_item_text_collapsible,
|
270
|
+
svg {
|
271
|
+
color: $white !important;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
.icon_wrapper:hover {
|
275
|
+
background-color: mix($white, $card_dark, 40%);
|
276
|
+
}
|
277
|
+
&[class*="_active"] {
|
278
|
+
.icon_wrapper:hover {
|
279
|
+
background-color: mix($primary, $card_light, 40%);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
&[class*="pb_collapsible_nav_item"][class*="_collapsible_trail"] {
|
284
|
+
.pb_collapsible_content_kit {
|
285
|
+
border-color: $border_dark;
|
286
|
+
}
|
287
|
+
}
|
24
288
|
}
|
25
289
|
}
|
26
290
|
}
|
27
|
-
}
|
@@ -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,57 +11,71 @@ import Collapsible from '../pb_collapsible/_collapsible'
|
|
11
11
|
type NavItemProps = {
|
12
12
|
active?: boolean,
|
13
13
|
aria?: { [key: string]: string },
|
14
|
+
fontWeight?: "regular" | "bold" | "bolder",
|
14
15
|
children?: React.ReactNode[] | React.ReactNode,
|
15
16
|
className?: string,
|
16
17
|
collapsible?: boolean,
|
17
|
-
collapsibleClick?: () => void,
|
18
18
|
data?: object,
|
19
|
+
dark?: boolean,
|
20
|
+
fontSize?: "normal" | "small",
|
19
21
|
iconLeft?: string,
|
20
22
|
iconRight?: string | string[],
|
21
|
-
|
22
|
-
|
23
|
+
onIconRightClick?: () => void,
|
24
|
+
onIconLeftClick?: () => void,
|
23
25
|
id?: string,
|
24
26
|
imageUrl?: string,
|
25
27
|
link?: string,
|
26
|
-
onClick?:
|
28
|
+
onClick?: () => void,
|
27
29
|
target?: '_blank' | '_self' | '_parent' | '_top',
|
28
30
|
text: string,
|
29
|
-
|
31
|
+
collapsibleTrail?: boolean,
|
32
|
+
collapsed?: boolean
|
30
33
|
} & GlobalProps
|
31
34
|
|
32
35
|
const NavItem = (props: NavItemProps) => {
|
33
36
|
const {
|
34
37
|
active = false,
|
35
38
|
aria = {},
|
39
|
+
fontWeight = "regular",
|
36
40
|
children,
|
37
41
|
className,
|
38
42
|
collapsible,
|
39
|
-
collapsibleClick,
|
40
43
|
data = {},
|
44
|
+
dark = false,
|
45
|
+
fontSize = "normal",
|
41
46
|
iconLeft,
|
42
47
|
iconRight,
|
43
|
-
|
44
|
-
|
48
|
+
onIconRightClick,
|
49
|
+
onIconLeftClick,
|
45
50
|
id,
|
46
51
|
imageUrl,
|
47
52
|
link,
|
48
53
|
onClick = () => { },
|
49
54
|
target = '_self',
|
50
55
|
text = '',
|
51
|
-
|
56
|
+
collapsibleTrail,
|
57
|
+
collapsed
|
52
58
|
} = props
|
53
59
|
|
54
60
|
const Tag = link ? 'a' : 'div'
|
55
61
|
const activeClass = active === true ? 'active' : ''
|
62
|
+
const collapsibleTrailClass = collapsible && collapsibleTrail ? 'collapsible_trail' : ''
|
63
|
+
const fontSizeClass = fontSize === 'small' ? "font_size_small" : "font_size_normal"
|
64
|
+
const fontWeightClass = fontWeight === 'bold' ? "font_bold" : fontWeight === 'bolder' ? "font_bolder" : "font_regular"
|
56
65
|
const ariaProps = buildAriaProps(aria)
|
57
66
|
const dataProps = buildDataProps(data)
|
58
|
-
const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass),
|
67
|
+
const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass),
|
68
|
+
collapsible ? buildCss('pb_collapsible_nav_item', activeClass, collapsibleTrailClass) : '',
|
69
|
+
fontSizeClass,
|
70
|
+
fontWeightClass,
|
71
|
+
globalProps(props),
|
72
|
+
className)
|
59
73
|
|
60
74
|
|
61
75
|
const handleIconClick = (e:any) => {
|
62
|
-
if (
|
76
|
+
if (onIconLeftClick) {
|
63
77
|
e.stopPropagation();
|
64
|
-
|
78
|
+
onIconLeftClick()
|
65
79
|
}
|
66
80
|
}
|
67
81
|
|
@@ -77,20 +91,19 @@ const NavItem = (props: NavItemProps) => {
|
|
77
91
|
<Collapsible icon={iconRight ? iconRight : ['plus','minus']}
|
78
92
|
iconSize="xs"
|
79
93
|
id={id}
|
80
|
-
collapsed={
|
81
|
-
|
82
|
-
onClick={
|
94
|
+
collapsed={collapsed}
|
95
|
+
onIconClick={onIconRightClick}
|
96
|
+
onClick={onClick}
|
83
97
|
>
|
84
|
-
<Collapsible.Main>
|
98
|
+
<Collapsible.Main dark={dark}>
|
85
99
|
<Tag
|
86
|
-
className="
|
100
|
+
className="pb_nav_list_item_link_collapsible"
|
87
101
|
href={link}
|
88
|
-
onClick={onClick}
|
89
102
|
target={target}
|
90
103
|
>
|
91
104
|
{imageUrl &&
|
92
105
|
<div
|
93
|
-
className="
|
106
|
+
className="pb_nav_list_item_icon_section_collapsible"
|
94
107
|
key={imageUrl}
|
95
108
|
onClick={(e)=>handleIconClick(e)}
|
96
109
|
>
|
@@ -103,18 +116,18 @@ const NavItem = (props: NavItemProps) => {
|
|
103
116
|
|
104
117
|
{iconLeft &&
|
105
118
|
<div
|
106
|
-
className="
|
119
|
+
className="pb_nav_list_item_icon_section_collapsible"
|
107
120
|
key={iconLeft}
|
108
121
|
onClick={(e)=>handleIconClick(e)}
|
109
122
|
>
|
110
123
|
<Icon
|
111
|
-
className="
|
124
|
+
className="pb_nav_list_item_icon_left_collapsible"
|
112
125
|
fixedWidth
|
113
126
|
icon={iconLeft}
|
114
127
|
/>
|
115
128
|
</div>
|
116
129
|
}
|
117
|
-
<span className="
|
130
|
+
<span className="pb_nav_list_item_text_collapsible">
|
118
131
|
{text}
|
119
132
|
</span>
|
120
133
|
</Tag>
|
@@ -27,14 +27,7 @@
|
|
27
27
|
}
|
28
28
|
[class*=_text] {
|
29
29
|
flex: 1;
|
30
|
-
font-weight: $regular;
|
31
30
|
}
|
32
|
-
}
|
33
|
-
&[class*=_active] [class*=_link] {
|
34
|
-
@include pb_title_4;
|
35
|
-
color: $primary;
|
36
|
-
letter-spacing: normal;
|
37
|
-
}
|
38
31
|
&:hover {
|
39
32
|
background-color: rgba($primary, 0.03);
|
40
33
|
[class*=_icon] {
|
@@ -44,5 +37,11 @@
|
|
44
37
|
color: $primary;
|
45
38
|
}
|
46
39
|
}
|
40
|
+
}
|
41
|
+
&[class*=_active] [class*=_link] {
|
42
|
+
@include pb_title_4;
|
43
|
+
color: $primary;
|
44
|
+
letter-spacing: normal;
|
45
|
+
}
|
47
46
|
}
|
48
47
|
}
|
@@ -1,63 +1,90 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import { Nav, NavItem
|
1
|
+
import React from "react";
|
2
|
+
import { Nav, NavItem } from '../..'
|
3
3
|
|
4
4
|
const CollapsibleNav = (props) => {
|
5
|
-
const navItems = ["Overview", "Albums", "Similar Artists"]
|
6
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
7
|
-
const collapsibles = navItems.map(() => useCollapsible(true))
|
8
|
-
|
9
|
-
const handleMainClick = (index) => {
|
10
|
-
collapsibles.forEach(([, , setCollapsed], idx) => {
|
11
|
-
if (idx === index) {
|
12
|
-
setCollapsed(false)
|
13
|
-
} else {
|
14
|
-
setCollapsed(true)
|
15
|
-
}
|
16
|
-
})
|
17
|
-
}
|
18
|
-
|
19
|
-
|
20
|
-
const handleIconRightClick = (index) => {
|
21
|
-
const [isCollapsed, setCollapsed] = collapsibles[index]
|
22
|
-
setCollapsed(!isCollapsed)
|
23
|
-
}
|
24
|
-
|
25
5
|
return (
|
26
|
-
|
27
|
-
<
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
6
|
+
<Nav>
|
7
|
+
<NavItem
|
8
|
+
active
|
9
|
+
collapsible
|
10
|
+
collapsibleTrail
|
11
|
+
fontWeight="bolder"
|
12
|
+
iconLeft="city"
|
13
|
+
iconRight={["plus", "minus"]}
|
14
|
+
link="#"
|
15
|
+
text="Overview"
|
16
|
+
{...props}
|
17
|
+
>
|
18
|
+
<NavItem
|
19
|
+
link="#"
|
20
|
+
text="City"
|
21
|
+
{...props}
|
22
|
+
/>
|
23
|
+
<NavItem
|
24
|
+
link="#"
|
25
|
+
text="People"
|
26
|
+
{...props}
|
27
|
+
/>
|
28
|
+
<NavItem
|
29
|
+
link="#"
|
30
|
+
text="Business"
|
31
|
+
{...props}
|
32
|
+
/>
|
33
|
+
</NavItem>
|
34
|
+
<NavItem
|
35
|
+
collapsible
|
36
|
+
collapsibleTrail
|
37
|
+
fontWeight="bolder"
|
38
|
+
iconLeft="theater-masks"
|
39
|
+
iconRight={["plus", "minus"]}
|
40
|
+
link="#"
|
41
|
+
text="Albums"
|
42
|
+
{...props}
|
43
|
+
>
|
44
|
+
<NavItem
|
45
|
+
link="#"
|
46
|
+
text="Entertainment"
|
47
|
+
{...props}
|
48
|
+
/>
|
49
|
+
<NavItem
|
50
|
+
link="#"
|
51
|
+
text="Food"
|
52
|
+
{...props}
|
53
|
+
/>
|
54
|
+
<NavItem
|
55
|
+
link="#"
|
56
|
+
text="Style"
|
57
|
+
{...props}
|
58
|
+
/>
|
59
|
+
</NavItem>
|
60
|
+
<NavItem
|
61
|
+
collapsible
|
62
|
+
collapsibleTrail
|
63
|
+
fontWeight="bolder"
|
64
|
+
iconLeft="city"
|
65
|
+
iconRight={["plus", "minus"]}
|
66
|
+
link="#"
|
67
|
+
text="Similar Artists"
|
68
|
+
{...props}
|
69
|
+
>
|
70
|
+
<NavItem
|
71
|
+
link="#"
|
72
|
+
text="City"
|
73
|
+
{...props}
|
74
|
+
/>
|
75
|
+
<NavItem
|
76
|
+
link="#"
|
77
|
+
text="People"
|
78
|
+
{...props}
|
79
|
+
/>
|
80
|
+
<NavItem
|
81
|
+
link="#"
|
82
|
+
text="Business"
|
83
|
+
{...props}
|
84
|
+
/>
|
85
|
+
</NavItem>
|
86
|
+
</Nav>
|
87
|
+
);
|
88
|
+
};
|
62
89
|
|
63
90
|
export default CollapsibleNav
|
@@ -0,0 +1 @@
|
|
1
|
+
The `collapsible` prop allows users to create a nested, collapsible nav. Pass `collapsible` to NavItem and nest as many more NavItems as needed as children for that NavItem to see this in action.
|