playbook_ui 12.38.0.pre.alpha.PLAY966collapsiblenav41082 → 12.38.0.pre.alpha.audiencesalpha1083
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 +0 -6
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +3 -3
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +9 -10
- 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 +8 -4
- 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/example.yml +6 -7
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +17 -280
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +0 -6
- data/app/pb_kits/playbook/pb_nav/_item.tsx +24 -75
- data/app/pb_kits/playbook/pb_nav/_nav.tsx +1 -18
- data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +7 -6
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +58 -85
- data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_custom_icons.jsx} +5 -14
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +3 -5
- data/app/pb_kits/playbook/pb_nav/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_nav/item.html.erb +4 -5
- data/app/pb_kits/playbook/pb_nav/item.rb +3 -29
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -10
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -75
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +0 -3
- data/app/pb_kits/playbook/pb_nav/_mixins.scss +0 -5
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +0 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +0 -58
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +0 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +0 -23
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +0 -1
@@ -11,109 +11,57 @@ 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",
|
15
14
|
children?: React.ReactNode[] | React.ReactNode,
|
16
15
|
className?: string,
|
17
16
|
collapsible?: boolean,
|
17
|
+
collapsibleClick?: () => void,
|
18
18
|
data?: object,
|
19
|
-
dark?: boolean,
|
20
|
-
fontSize?: "normal" | "small",
|
21
19
|
iconLeft?: string,
|
22
20
|
iconRight?: string | string[],
|
23
|
-
|
24
|
-
|
21
|
+
iconRightClick?: () => void,
|
22
|
+
iconLeftClick?: () => void,
|
25
23
|
id?: string,
|
26
24
|
imageUrl?: string,
|
27
25
|
link?: string,
|
28
|
-
onClick?:
|
26
|
+
onClick?: React.MouseEventHandler<HTMLElement>,
|
29
27
|
target?: '_blank' | '_self' | '_parent' | '_top',
|
30
28
|
text: string,
|
31
|
-
|
32
|
-
collapsed?: boolean,
|
33
|
-
paddingBottom?: string,
|
34
|
-
paddingTop?: string,
|
35
|
-
paddingLeft?: string,
|
36
|
-
paddingRight?: string,
|
37
|
-
paddingX?: string,
|
38
|
-
paddingY?: string,
|
39
|
-
padding?: 'none' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
40
|
-
orientation?: "vertical" | "horizontal",
|
41
|
-
variant?: "normal" | "subtle",
|
29
|
+
toggleCollapsed?: any
|
42
30
|
} & GlobalProps
|
43
31
|
|
44
32
|
const NavItem = (props: NavItemProps) => {
|
45
33
|
const {
|
46
34
|
active = false,
|
47
35
|
aria = {},
|
48
|
-
fontWeight = "regular",
|
49
36
|
children,
|
50
37
|
className,
|
51
38
|
collapsible,
|
39
|
+
collapsibleClick,
|
52
40
|
data = {},
|
53
|
-
dark = false,
|
54
|
-
fontSize = "normal",
|
55
41
|
iconLeft,
|
56
42
|
iconRight,
|
57
|
-
|
58
|
-
|
43
|
+
iconRightClick,
|
44
|
+
iconLeftClick,
|
59
45
|
id,
|
60
46
|
imageUrl,
|
61
47
|
link,
|
62
48
|
onClick = () => { },
|
63
49
|
target = '_self',
|
64
50
|
text = '',
|
65
|
-
|
66
|
-
collapsed,
|
67
|
-
// orientation,
|
68
|
-
// variant,
|
69
|
-
padding,
|
70
|
-
paddingX,
|
71
|
-
paddingY,
|
72
|
-
paddingBottom,
|
73
|
-
paddingTop,
|
74
|
-
paddingLeft,
|
75
|
-
paddingRight
|
51
|
+
toggleCollapsed
|
76
52
|
} = props
|
77
53
|
|
78
|
-
const filteredProps = {...props}
|
79
|
-
delete filteredProps?.padding
|
80
|
-
delete filteredProps?.paddingX
|
81
|
-
delete filteredProps?.paddingY
|
82
|
-
delete filteredProps?.paddingBottom
|
83
|
-
delete filteredProps?.paddingTop
|
84
|
-
delete filteredProps?.paddingRight
|
85
|
-
delete filteredProps?.paddingLeft
|
86
|
-
|
87
54
|
const Tag = link ? 'a' : 'div'
|
88
55
|
const activeClass = active === true ? 'active' : ''
|
89
|
-
const collapsibleTrailClass = collapsible && collapsibleTrail ? 'collapsible_trail' : ''
|
90
|
-
const fontSizeClass = fontSize === 'small' ? "font_size_small" : "font_size_normal"
|
91
|
-
const fontWeightClass = fontWeight === 'bold' ? "font_bold" : fontWeight === 'bolder' ? "font_bolder" : "font_regular"
|
92
56
|
const ariaProps = buildAriaProps(aria)
|
93
57
|
const dataProps = buildDataProps(data)
|
94
|
-
const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass),
|
95
|
-
collapsible ? buildCss('pb_collapsible_nav_item', activeClass, collapsibleTrailClass) : '',
|
96
|
-
fontSizeClass,
|
97
|
-
fontWeightClass,
|
98
|
-
globalProps(filteredProps),
|
99
|
-
className)
|
100
|
-
|
101
|
-
const tagClasses = classnames(collapsible ? 'pb_nav_list_item_link_collapsible' : "pb_nav_list_item_link",
|
102
|
-
globalProps({
|
103
|
-
padding,
|
104
|
-
paddingBottom,
|
105
|
-
paddingLeft,
|
106
|
-
paddingRight,
|
107
|
-
paddingTop,
|
108
|
-
paddingX,
|
109
|
-
paddingY,
|
110
|
-
}))
|
58
|
+
const classes = classnames(buildCss('pb_nav_list_kit_item', activeClass), collapsible ? 'pb_collapsible_nav_item' : '', globalProps(props), className)
|
111
59
|
|
112
60
|
|
113
61
|
const handleIconClick = (e:any) => {
|
114
|
-
if (
|
62
|
+
if (iconLeftClick) {
|
115
63
|
e.stopPropagation();
|
116
|
-
|
64
|
+
iconLeftClick()
|
117
65
|
}
|
118
66
|
}
|
119
67
|
|
@@ -129,19 +77,20 @@ const NavItem = (props: NavItemProps) => {
|
|
129
77
|
<Collapsible icon={iconRight ? iconRight : ['plus','minus']}
|
130
78
|
iconSize="xs"
|
131
79
|
id={id}
|
132
|
-
collapsed={
|
133
|
-
|
134
|
-
onClick={
|
80
|
+
collapsed={toggleCollapsed}
|
81
|
+
iconClick={iconRightClick}
|
82
|
+
onClick={collapsibleClick}
|
135
83
|
>
|
136
|
-
<Collapsible.Main
|
84
|
+
<Collapsible.Main>
|
137
85
|
<Tag
|
138
|
-
className=
|
86
|
+
className="pb_nav_list_item_link"
|
139
87
|
href={link}
|
88
|
+
onClick={onClick}
|
140
89
|
target={target}
|
141
90
|
>
|
142
91
|
{imageUrl &&
|
143
92
|
<div
|
144
|
-
className="
|
93
|
+
className="pb_nav_list_item_icon_section"
|
145
94
|
key={imageUrl}
|
146
95
|
onClick={(e)=>handleIconClick(e)}
|
147
96
|
>
|
@@ -154,18 +103,18 @@ const NavItem = (props: NavItemProps) => {
|
|
154
103
|
|
155
104
|
{iconLeft &&
|
156
105
|
<div
|
157
|
-
className="
|
106
|
+
className="pb_nav_list_item_icon_section"
|
158
107
|
key={iconLeft}
|
159
108
|
onClick={(e)=>handleIconClick(e)}
|
160
109
|
>
|
161
110
|
<Icon
|
162
|
-
className="
|
111
|
+
className="pb_nav_list_item_icon_left"
|
163
112
|
fixedWidth
|
164
113
|
icon={iconLeft}
|
165
114
|
/>
|
166
115
|
</div>
|
167
116
|
}
|
168
|
-
<span className="
|
117
|
+
<span className="pb_nav_list_item_text">
|
169
118
|
{text}
|
170
119
|
</span>
|
171
120
|
</Tag>
|
@@ -176,8 +125,8 @@ const NavItem = (props: NavItemProps) => {
|
|
176
125
|
</Collapsible>
|
177
126
|
) : (
|
178
127
|
<Tag
|
179
|
-
|
180
|
-
|
128
|
+
className="pb_nav_list_item_link"
|
129
|
+
href={link}
|
181
130
|
onClick={onClick}
|
182
131
|
target={target}
|
183
132
|
>
|
@@ -22,11 +22,6 @@ type NavProps = {
|
|
22
22
|
variant?: "normal" | "subtle",
|
23
23
|
} & GlobalProps
|
24
24
|
|
25
|
-
type NavChildProps = {
|
26
|
-
orientation: "vertical" | "horizontal";
|
27
|
-
variant: "normal" | "subtle";
|
28
|
-
};
|
29
|
-
|
30
25
|
const Nav = (props: NavProps) => {
|
31
26
|
const {
|
32
27
|
aria = {},
|
@@ -55,18 +50,6 @@ const Nav = (props: NavProps) => {
|
|
55
50
|
className
|
56
51
|
)
|
57
52
|
|
58
|
-
// Map over the children and clone them with orientation and variant props to gain access to them in navItem
|
59
|
-
const childrenWithProps = React.Children.map(children, (child) => {
|
60
|
-
if (React.isValidElement(child)) {
|
61
|
-
const childProps: NavChildProps = {
|
62
|
-
orientation: orientation,
|
63
|
-
variant: variant,
|
64
|
-
};
|
65
|
-
return React.cloneElement(child, childProps);
|
66
|
-
}
|
67
|
-
return child;
|
68
|
-
});
|
69
|
-
|
70
53
|
return (
|
71
54
|
<nav
|
72
55
|
{...ariaProps}
|
@@ -89,7 +72,7 @@ const childrenWithProps = React.Children.map(children, (child) => {
|
|
89
72
|
</a>
|
90
73
|
</div>
|
91
74
|
}
|
92
|
-
<ul>{
|
75
|
+
<ul>{children}</ul>
|
93
76
|
</nav>
|
94
77
|
)
|
95
78
|
}
|
@@ -27,7 +27,14 @@
|
|
27
27
|
}
|
28
28
|
[class*=_text] {
|
29
29
|
flex: 1;
|
30
|
+
font-weight: $regular;
|
30
31
|
}
|
32
|
+
}
|
33
|
+
&[class*=_active] [class*=_link] {
|
34
|
+
@include pb_title_4;
|
35
|
+
color: $primary;
|
36
|
+
letter-spacing: normal;
|
37
|
+
}
|
31
38
|
&:hover {
|
32
39
|
background-color: rgba($primary, 0.03);
|
33
40
|
[class*=_icon] {
|
@@ -37,11 +44,5 @@
|
|
37
44
|
color: $primary;
|
38
45
|
}
|
39
46
|
}
|
40
|
-
}
|
41
|
-
&[class*=_active] [class*=_link] {
|
42
|
-
@include pb_title_4;
|
43
|
-
color: $primary;
|
44
|
-
letter-spacing: normal;
|
45
|
-
}
|
46
47
|
}
|
47
48
|
}
|
@@ -1,90 +1,63 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import { Nav, NavItem } from
|
1
|
+
import React from "react"
|
2
|
+
import { Nav, NavItem, useCollapsible } 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
|
+
|
5
25
|
return (
|
6
|
-
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
};
|
26
|
+
<>
|
27
|
+
<Nav variant='subtle'>
|
28
|
+
{navItems.map((text, index) => {
|
29
|
+
const [collapsed] = collapsibles[index]
|
30
|
+
return (
|
31
|
+
<NavItem
|
32
|
+
collapsible
|
33
|
+
collapsibleClick={() => handleMainClick(index)}
|
34
|
+
iconLeft="chevron-down"
|
35
|
+
iconRightClick={() => handleIconRightClick(index)}
|
36
|
+
id={`collapsible-nav-item-${index + 1}`}
|
37
|
+
key={index}
|
38
|
+
link="#"
|
39
|
+
text={text}
|
40
|
+
toggleCollapsed={collapsed}
|
41
|
+
{...props}
|
42
|
+
>
|
43
|
+
<NavItem link="#"
|
44
|
+
text="City"
|
45
|
+
{...props}
|
46
|
+
/>
|
47
|
+
<NavItem link="#"
|
48
|
+
text="People"
|
49
|
+
{...props}
|
50
|
+
/>
|
51
|
+
<NavItem link="#"
|
52
|
+
text="Business"
|
53
|
+
{...props}
|
54
|
+
/>
|
55
|
+
</NavItem>
|
56
|
+
);
|
57
|
+
})}
|
58
|
+
</Nav>
|
59
|
+
</>
|
60
|
+
)
|
61
|
+
}
|
89
62
|
|
90
63
|
export default CollapsibleNav
|
@@ -1,15 +1,11 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Nav, NavItem } from '../..'
|
3
3
|
|
4
|
-
const
|
4
|
+
const CollapsibleNavCustomIcons = (props) => {
|
5
5
|
return (
|
6
|
-
<Nav variant="
|
6
|
+
<Nav variant="subtle">
|
7
7
|
<NavItem
|
8
|
-
|
9
|
-
collapsible
|
10
|
-
collapsibleTrail
|
11
|
-
fontSize="small"
|
12
|
-
fontWeight="bolder"
|
8
|
+
collapsible
|
13
9
|
iconLeft="city"
|
14
10
|
iconRight={["plus", "minus"]}
|
15
11
|
link="#"
|
@@ -33,10 +29,8 @@ const CollapsibleNavEmphasize = (props) => {
|
|
33
29
|
/>
|
34
30
|
</NavItem>
|
35
31
|
<NavItem
|
32
|
+
active
|
36
33
|
collapsible
|
37
|
-
collapsibleTrail
|
38
|
-
fontSize="small"
|
39
|
-
fontWeight="bolder"
|
40
34
|
iconLeft="theater-masks"
|
41
35
|
iconRight={["plus", "minus"]}
|
42
36
|
link="#"
|
@@ -61,9 +55,6 @@ const CollapsibleNavEmphasize = (props) => {
|
|
61
55
|
</NavItem>
|
62
56
|
<NavItem
|
63
57
|
collapsible
|
64
|
-
collapsibleTrail
|
65
|
-
fontSize="small"
|
66
|
-
fontWeight="bolder"
|
67
58
|
iconLeft="city"
|
68
59
|
iconRight={["plus", "minus"]}
|
69
60
|
link="#"
|
@@ -90,4 +81,4 @@ const CollapsibleNavEmphasize = (props) => {
|
|
90
81
|
);
|
91
82
|
};
|
92
83
|
|
93
|
-
export default
|
84
|
+
export default CollapsibleNavCustomIcons;
|
@@ -7,8 +7,7 @@ examples:
|
|
7
7
|
- borderless_nav: No Borders
|
8
8
|
- subtle_nav: Subtle Variant
|
9
9
|
- subtle_with_icons_nav: Subtle With Icons
|
10
|
-
- collapsible_nav: Collapsible
|
11
|
-
- collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
|
10
|
+
# - collapsible_nav: Subtle With Collapsible
|
12
11
|
- subtle_no_highlight_nav: Subtle No Highlight
|
13
12
|
- bold_vertical_nav: Bold Variant
|
14
13
|
- horizontal_nav: Horizontal Nav
|
@@ -26,9 +25,8 @@ examples:
|
|
26
25
|
- borderless_nav: No Borders
|
27
26
|
- subtle_nav: Subtle Variant
|
28
27
|
- subtle_with_icons_nav: Subtle With Icons
|
29
|
-
- collapsible_nav: Collapsible
|
30
|
-
-
|
31
|
-
- collapsible_nav_custom: Collapsible Nav With Custom Toggling
|
28
|
+
# - collapsible_nav: Subtle With Collapsible
|
29
|
+
# - collapsible_nav_custom_icons: Subtle With Collapsible (No custom toggling)
|
32
30
|
- subtle_no_highlight_nav: Subtle No Highlight
|
33
31
|
- bold_vertical_nav: Bold Variant
|
34
32
|
- horizontal_nav: Horizontal Nav
|
@@ -14,5 +14,4 @@ export { default as NewTab } from './_new_tab.jsx'
|
|
14
14
|
export { default as BoldHorizontalNav } from './_bold_horizontal_nav.jsx'
|
15
15
|
export { default as BoldVerticalNav } from './_bold_vertical_nav.jsx'
|
16
16
|
export { default as CollapsibleNav } from './_collapsible_nav.jsx'
|
17
|
-
export { default as
|
18
|
-
export { default as CollapsibleNavEmphasize } from "./_collapsible_nav_emphasize.jsx"
|
17
|
+
export { default as CollapsibleNavCustomIcons } from './_collapsible_nav_custom_icons.jsx'
|
@@ -2,20 +2,19 @@
|
|
2
2
|
aria: object.aria,
|
3
3
|
class: object.classname,
|
4
4
|
data: object.data,
|
5
|
-
dark: object.dark,
|
6
5
|
id: object.id) do %>
|
7
6
|
<% if object.collapsible %>
|
8
7
|
<%= pb_rails("collapsible", props: { name: "collapsible-nav-example" }) do %>
|
9
|
-
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs"
|
8
|
+
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs" }) do %>
|
10
9
|
<%= content_tag(object.tag,
|
11
10
|
object.link ? object.link_options : object.options) do %>
|
12
11
|
<% if object.image_url %>
|
13
|
-
<%= pb_rails("image", props: { url: object.image_url, classname: "
|
12
|
+
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
|
14
13
|
<% end %>
|
15
14
|
<% if object.icon_left %>
|
16
|
-
<%= pb_rails("icon", props: { icon: object.icon_left, classname: "
|
15
|
+
<%= pb_rails("icon", props: { icon: object.icon_left, classname: "pb_nav_list_item_icon_left", fixed_width: true}) %>
|
17
16
|
<% end %>
|
18
|
-
<span class="
|
17
|
+
<span class="pb_nav_list_item_text">
|
19
18
|
<%= object.text %>
|
20
19
|
</span>
|
21
20
|
<% end %>
|
@@ -4,16 +4,9 @@ module Playbook
|
|
4
4
|
module PbNav
|
5
5
|
class Item < Playbook::KitBase
|
6
6
|
prop :active, 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"
|
13
7
|
prop :collapsible, type: Playbook::Props::Boolean, default: false
|
14
8
|
prop :link
|
15
9
|
prop :text
|
16
|
-
prop :collapsible_trail, type: Playbook::Props::Boolean, default: false
|
17
10
|
prop :icon_left
|
18
11
|
prop :icon_right
|
19
12
|
prop :image_url
|
@@ -22,9 +15,9 @@ module Playbook
|
|
22
15
|
default: "_self"
|
23
16
|
def classname
|
24
17
|
if collapsible
|
25
|
-
"#{generate_classname('pb_nav_list_kit_item', active_class)}
|
18
|
+
"pb_collapsible_nav_item #{generate_classname('pb_nav_list_kit_item', active_class)}"
|
26
19
|
else
|
27
|
-
|
20
|
+
generate_classname("pb_nav_list_kit_item", active_class)
|
28
21
|
end
|
29
22
|
end
|
30
23
|
|
@@ -34,7 +27,7 @@ module Playbook
|
|
34
27
|
|
35
28
|
def options
|
36
29
|
{
|
37
|
-
class:
|
30
|
+
class: "pb_nav_list_item_link",
|
38
31
|
}.compact
|
39
32
|
end
|
40
33
|
|
@@ -54,25 +47,6 @@ module Playbook
|
|
54
47
|
def active_class
|
55
48
|
active ? "active" : nil
|
56
49
|
end
|
57
|
-
|
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
|
67
|
-
end
|
68
|
-
|
69
|
-
def collapsible_trail_class
|
70
|
-
collapsible_trail ? "collapsible_trail" : nil
|
71
|
-
end
|
72
|
-
|
73
|
-
def font_size_class
|
74
|
-
font_size === "small" ? "font_size_small" : "font_size_normal"
|
75
|
-
end
|
76
50
|
end
|
77
51
|
end
|
78
52
|
end
|