@servicetitan/navigation 2.4.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/side-navigation/icons.d.ts +4 -0
- package/dist/components/side-navigation/icons.d.ts.map +1 -0
- package/dist/components/side-navigation/icons.js +5 -0
- package/dist/components/side-navigation/icons.js.map +1 -0
- package/dist/components/side-navigation/side-navigation.d.ts +6 -1
- package/dist/components/side-navigation/side-navigation.d.ts.map +1 -1
- package/dist/components/side-navigation/side-navigation.js +20 -3
- package/dist/components/side-navigation/side-navigation.js.map +1 -1
- package/dist/components/side-navigation/side-navigation.module.less +71 -34
- package/dist/components/side-navigation/side-navigation.stories.js +1 -1
- package/dist/components/side-navigation/side-navigation.stories.js.map +1 -1
- package/package.json +2 -2
- package/src/components/side-navigation/icons.tsx +73 -0
- package/src/components/side-navigation/side-navigation.module.less +71 -34
- package/src/components/side-navigation/side-navigation.module.less.d.ts +9 -2
- package/src/components/side-navigation/side-navigation.stories.tsx +1 -1
- package/src/components/side-navigation/side-navigation.tsx +102 -15
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const IconSideOptions: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const IconSideSlim: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const IconSideExpanded: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/icons.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,+CAyB3B,CAAC;AAEF,eAAO,MAAM,YAAY,+CAkBxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAyB5B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const IconSideOptions = () => (_jsxs("svg", { width: "1em", height: "1em", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M1 3C1 1.89543 1.89543 1 3 1H7V17H3C1.89543 17 1 16.1046 1 15V3Z", stroke: "currentColor", strokeWidth: "2", strokeOpacity: "1" }), _jsx("rect", { x: "1", y: "1", width: "16", height: "16", rx: "2", stroke: "currentColor", strokeWidth: "2", strokeOpacity: "1" })] }));
|
|
3
|
+
export const IconSideSlim = () => (_jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M3 6.375C3 4.51104 4.51104 3 6.375 3H17.625C19.489 3 21 4.51104 21 6.375V17.625C21 19.489 19.489 21 17.625 21H6.375C4.51104 21 3 19.489 3 17.625V6.375Z", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M7 8L7 16", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round" })] }));
|
|
4
|
+
export const IconSideExpanded = () => (_jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M3 6.375C3 4.51104 4.51104 3 6.375 3H17.625C19.489 3 21 4.51104 21 6.375V17.625C21 19.489 19.489 21 17.625 21H6.375C4.51104 21 3 19.489 3 17.625V6.375Z", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M7 8L7 16", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round" }), _jsx("path", { d: "M11 8V16", stroke: "currentColor", strokeOpacity: "1", strokeWidth: "2", strokeLinecap: "round" })] }));
|
|
5
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","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eACI,CAAC,EAAC,yJAAyJ,EAC3J,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,GAAG,EACjB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,GACxB,EACF,eACI,CAAC,EAAC,WAAW,EACb,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,GAAG,EACjB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,GACvB,EACF,eACI,CAAC,EAAC,UAAU,EACZ,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,GAAG,EACjB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,GACvB,IACA,CACT,CAAC"}
|
|
@@ -12,7 +12,7 @@ export interface SideNavigationProps {
|
|
|
12
12
|
/** navigation component used for routing */
|
|
13
13
|
navigationComponent?: FC<NavLinkComponentProps>;
|
|
14
14
|
/** expand change handler */
|
|
15
|
-
|
|
15
|
+
onExpandedChange(expanded: boolean): void;
|
|
16
16
|
}
|
|
17
17
|
export declare const SideNavigation: FC<SideNavigationProps>;
|
|
18
18
|
interface SideNavigationItemProps extends HeaderNavigationItemData {
|
|
@@ -20,5 +20,10 @@ interface SideNavigationItemProps extends HeaderNavigationItemData {
|
|
|
20
20
|
}
|
|
21
21
|
/** Side Navigation menu item */
|
|
22
22
|
export declare const SideNavigationItem: FC<SideNavigationItemProps>;
|
|
23
|
+
/** Side Navigation options item */
|
|
24
|
+
export declare const SideNavigationOptions: FC<{
|
|
25
|
+
expanded?: boolean;
|
|
26
|
+
onExpandedChange(expanded: boolean): void;
|
|
27
|
+
}>;
|
|
23
28
|
export {};
|
|
24
29
|
//# sourceMappingURL=side-navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-navigation.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"side-navigation.d.ts","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAWzF,MAAM,WAAW,mBAAmB;IAChC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACnC,uBAAuB;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAC;IAChD,4BAA4B;IAC5B,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7C;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAkClD,CAAC;AAEF,UAAU,uBAAwB,SAAQ,wBAAwB;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,gCAAgC;AAChC,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CA6C1D,CAAC;AAEF,mCAAmC;AACnC,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7C,CA8DA,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { BodyText, Divider, Eyebrow, Icon, Popover, Stack } from '@servicetitan/design-system';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
+
import { useState } from 'react';
|
|
4
5
|
import { DefaultNavLinkComponent, NavLinkContext, useNavLink, } from '../../utils/navigation-context';
|
|
5
6
|
import { withTooltip } from '../../utils/with-tooltip';
|
|
6
7
|
import { CounterTag } from '../counter-tag';
|
|
8
|
+
import { IconSideExpanded, IconSideOptions, IconSideSlim } from './icons';
|
|
7
9
|
import * as Styles from './side-navigation.module.less';
|
|
8
|
-
export const SideNavigation = ({ className, expanded, id, items, navigationComponent = DefaultNavLinkComponent,
|
|
9
|
-
return (_jsx(NavLinkContext.Provider, { value: navigationComponent, children: _jsxs("div", { className: classNames(Styles.sideNav, expanded ? Styles.sideNavExpanded : Styles.
|
|
10
|
+
export const SideNavigation = ({ className, expanded, id, items, navigationComponent = DefaultNavLinkComponent, onExpandedChange, }) => {
|
|
11
|
+
return (_jsx(NavLinkContext.Provider, { value: navigationComponent, children: _jsxs("div", { className: classNames(Styles.sideNav, expanded ? Styles.sideNavExpanded : Styles.sideNavSlim, className), id: id, "data-cy": "side-navigation", children: [_jsx("div", { className: Styles.sideNavContent, "data-cy": "navigation-items", children: items === null || items === void 0 ? void 0 : items.map(item => (_jsx(SideNavigationItem, Object.assign({ expanded: expanded }, item), item.id))) }), _jsxs("div", { className: Styles.sideNavBottom, children: [_jsx("div", { className: Styles.sideNavBottomDivider }), _jsx(SideNavigationOptions, { expanded: expanded, onExpandedChange: onExpandedChange })] })] }) }));
|
|
10
12
|
};
|
|
11
13
|
/** Side Navigation menu item */
|
|
12
14
|
export const SideNavigationItem = ({ id, to, title, hint, counter, className, iconClassName, iconComponent: IconComponent, iconName, isActive, expanded, }) => {
|
|
@@ -16,4 +18,19 @@ export const SideNavigationItem = ({ id, to, title, hint, counter, className, ic
|
|
|
16
18
|
[Styles.navigationItemActive]: isActive === true,
|
|
17
19
|
}), isActive: typeof isActive === 'function' ? isActive : undefined, activeClassName: Styles.navigationItemActive, children: [IconComponent ? (_jsx("i", { className: iconClass, children: _jsx(IconComponent, {}) })) : iconName ? (_jsx(Icon, { name: iconName, className: iconClass })) : (_jsx("i", { className: iconClass })), !!expanded && _jsx("span", { className: Styles.navigationItemText, children: title }), !!counter && _jsx(CounterTag, { data: counter, className: Styles.navigationItemCounter })] }, id), expanded ? undefined : title, 'r');
|
|
18
20
|
};
|
|
21
|
+
/** Side Navigation options item */
|
|
22
|
+
export const SideNavigationOptions = ({ expanded, onExpandedChange }) => {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
const trigger = withTooltip(_jsxs("div", { "data-cy": "navigation-left-options", "data-pendo": "navigation-left-options", className: classNames(Styles.optionsItem), onClick: () => setOpen(!open), children: [_jsx("div", { className: Styles.optionsIcon, children: _jsx(IconSideOptions, {}) }), !!expanded && _jsx("span", { className: Styles.optionsItemText, children: "Menu Options" })] }), open || expanded ? undefined : 'Menu Options', 'r');
|
|
25
|
+
const onExpand = () => {
|
|
26
|
+
setOpen(false);
|
|
27
|
+
onExpandedChange(true);
|
|
28
|
+
};
|
|
29
|
+
const onCollapse = () => {
|
|
30
|
+
setOpen(false);
|
|
31
|
+
onExpandedChange(false);
|
|
32
|
+
};
|
|
33
|
+
return (_jsxs(Popover, { className: "bg-neutral-30", trigger: trigger, direction: "tr", onClickOutside: () => setOpen(false), open: open, padding: "s", width: "xs", children: [_jsx(Eyebrow, { className: "p-l-2", children: "menu options" }), _jsx(SideNavigationOptionsItem, { active: !expanded, icon: IconSideSlim, title: "Slim", onClick: onCollapse }), _jsx(SideNavigationOptionsItem, { active: !!expanded, icon: IconSideExpanded, title: "Expanded", onClick: onExpand }), _jsx(Divider, { className: "m-x-half m-y-1" }), _jsx(SideNavigationOptionsItem, { active: false, icon: expanded ? IconSideExpanded : IconSideSlim, title: expanded ? 'Expanded' : 'Slim' })] }));
|
|
34
|
+
};
|
|
35
|
+
const SideNavigationOptionsItem = ({ active, onClick, title, icon: IconComponent }) => (_jsxs(Stack, { className: classNames(active ? Styles.optionsPopoverItemActive : Styles.optionsPopoverItemInactive, 'p-y-1 p-x-2', { [Styles.optionsPopoverItemClickable]: onClick && !active }), alignItems: "center", onClick: !active && onClick, children: [_jsx(IconComponent, {}), _jsx(BodyText, { className: "c-inherit m-l-1 flex-grow-1 flex-basis-0", children: title }), active && _jsx(Icon, { name: "check" })] }));
|
|
19
36
|
//# sourceMappingURL=side-navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-navigation.js","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"side-navigation.js","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EACH,uBAAuB,EACvB,cAAc,EACd,UAAU,GACb,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAiBxD,MAAM,CAAC,MAAM,cAAc,GAA4B,CAAC,EACpD,SAAS,EACT,QAAQ,EACR,EAAE,EACF,KAAK,EACL,mBAAmB,GAAG,uBAAuB,EAC7C,gBAAgB,GACnB,EAAE,EAAE;IACD,OAAO,CACH,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,YAC/C,eACI,SAAS,EAAE,UAAU,CACjB,MAAM,CAAC,OAAO,EACd,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EACtD,SAAS,CACZ,EACD,E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K,IACF,SAAS,EAAE,UAAU,CACjB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,MAAM,CAAC,0BAA0B,EAC5E,aAAa,EACb,EAAE,CAAC,MAAM,CAAC,2BAA2B,CAAC,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE,CAC/D,EACD,UAAU,EAAC,QAAQ,EACnB,OAAO,EAAE,CAAC,MAAM,IAAI,OAAO,aAE3B,KAAC,aAAa,KAAG,EACjB,KAAC,QAAQ,IAAC,SAAS,EAAC,0CAA0C,YAAE,KAAK,GAAY,EAChF,MAAM,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,IAC5B,CACX,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/* stylelint-disable no-descending-specificity */
|
|
2
2
|
@import (reference) '@servicetitan/tokens/core/tokens.less';
|
|
3
3
|
|
|
4
|
+
@text-color: #383838;
|
|
5
|
+
@border-color: #c5c5cb;
|
|
6
|
+
|
|
4
7
|
.side-nav {
|
|
5
8
|
display: flex;
|
|
6
9
|
flex-direction: column;
|
|
@@ -12,21 +15,22 @@
|
|
|
12
15
|
transition: width 100ms ease-in-out;
|
|
13
16
|
|
|
14
17
|
background-color: #ebebeb;
|
|
15
|
-
border-right: 1px solid
|
|
18
|
+
border-right: 1px solid @border-color;
|
|
19
|
+
|
|
20
|
+
.side-nav-bottom {
|
|
21
|
+
padding-left: 12px;
|
|
22
|
+
padding-right: 12px;
|
|
16
23
|
|
|
17
|
-
.side-nav-top {
|
|
18
24
|
display: flex;
|
|
19
|
-
flex-direction:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
border-bottom: 1px solid #c5c5cb;
|
|
26
|
-
padding-left: @spacing-1;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
|
|
28
|
+
.sideNavBottomDivider {
|
|
29
|
+
border-top: 1px solid @border-color;
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
&.side-nav-
|
|
33
|
+
&.side-nav-slim {
|
|
30
34
|
width: 56px;
|
|
31
35
|
|
|
32
36
|
.navigation-item-counter {
|
|
@@ -39,27 +43,6 @@
|
|
|
39
43
|
|
|
40
44
|
&.side-nav-expanded {
|
|
41
45
|
width: 240px;
|
|
42
|
-
|
|
43
|
-
.side-nav-top :global(.Button) {
|
|
44
|
-
padding: @spacing-1 !important;
|
|
45
|
-
border-radius: 12px;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
|
|
48
|
-
:global(.Button__content) {
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
white-space: nowrap;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:global(.Button__icon) {
|
|
54
|
-
font-size: 24px;
|
|
55
|
-
padding-left: @spacing-0;
|
|
56
|
-
padding-right: @spacing-1;
|
|
57
|
-
|
|
58
|
-
svg {
|
|
59
|
-
transform: rotateY(180deg);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
46
|
}
|
|
64
47
|
|
|
65
48
|
.side-nav-content {
|
|
@@ -69,6 +52,8 @@
|
|
|
69
52
|
overflow-y: auto;
|
|
70
53
|
margin-top: @spacing-1;
|
|
71
54
|
margin-bottom: @spacing-1;
|
|
55
|
+
flex-grow: 1;
|
|
56
|
+
flex-basis: 0;
|
|
72
57
|
}
|
|
73
58
|
}
|
|
74
59
|
|
|
@@ -88,8 +73,7 @@
|
|
|
88
73
|
border-radius: 12px;
|
|
89
74
|
|
|
90
75
|
&.navigation-item-active {
|
|
91
|
-
color: @color-white
|
|
92
|
-
background-color: @color-neutral-500;
|
|
76
|
+
background-color: @color-white;
|
|
93
77
|
}
|
|
94
78
|
|
|
95
79
|
&:hover:not(.navigation-item-active) {
|
|
@@ -114,3 +98,56 @@
|
|
|
114
98
|
width: 24px;
|
|
115
99
|
font-size: 24px;
|
|
116
100
|
}
|
|
101
|
+
|
|
102
|
+
.options-item {
|
|
103
|
+
font-family: @base-font-family;
|
|
104
|
+
color: @text-color;
|
|
105
|
+
position: relative;
|
|
106
|
+
display: flex;
|
|
107
|
+
justify-content: flex-start;
|
|
108
|
+
align-items: center;
|
|
109
|
+
flex-wrap: nowrap;
|
|
110
|
+
text-wrap: nowrap;
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
height: 32px;
|
|
113
|
+
|
|
114
|
+
margin-top: @spacing-1;
|
|
115
|
+
margin-bottom: @spacing-1;
|
|
116
|
+
border-radius: 8px;
|
|
117
|
+
|
|
118
|
+
&:hover {
|
|
119
|
+
background-color: @color-white;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.options-icon {
|
|
123
|
+
height: 18px;
|
|
124
|
+
width: 18px;
|
|
125
|
+
font-size: 18px;
|
|
126
|
+
padding-left: 7px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.options-item-text {
|
|
130
|
+
font-family: @base-font-family;
|
|
131
|
+
font-size: @typescale-3;
|
|
132
|
+
padding-left: @spacing-2;
|
|
133
|
+
flex: 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.options-popover-item-clickable {
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
|
|
140
|
+
&:hover {
|
|
141
|
+
background-color: @color-neutral-60;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.options-popover-item-active {
|
|
146
|
+
background-color: @color-blue-100;
|
|
147
|
+
color: @color-blue-500;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.options-popover-item-inactive,
|
|
151
|
+
.options-popover-item-active {
|
|
152
|
+
border-radius: @border-radius-1;
|
|
153
|
+
}
|
|
@@ -33,7 +33,7 @@ const NavLinkMock = props => (_jsx("a", { href: props.to, target: props.target,
|
|
|
33
33
|
}, className: props.className, children: props.children }));
|
|
34
34
|
export const DefaultSideNavigation = () => {
|
|
35
35
|
const [expanded, setExpanded] = useState(false);
|
|
36
|
-
return (_jsx(SideNavigation, { navigationComponent: NavLinkMock, expanded: expanded,
|
|
36
|
+
return (_jsx(SideNavigation, { navigationComponent: NavLinkMock, expanded: expanded, onExpandedChange: setExpanded, items: [
|
|
37
37
|
items.dashboard,
|
|
38
38
|
items.calendar,
|
|
39
39
|
items.calls,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-navigation.stories.js","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,MAAM,MAAM,GAAG,CAAC,KAAoB,EAAE,EAAE;IACpC,OAAO,CACH,eAAK,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAClD,KAAC,KAAK,KAAG,EACT,cAAK,SAAS,EAAC,0BAA0B,GAAG,IAC1C,CACT,CAAC;AACN,CAAC,CAAC;AACF,eAAe;IACX,KAAK,EAAE,2BAA2B;IAClC,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,UAAU,EAAE,EAAE;CACjB,CAAC;AAEF,MAAM,OAAO,GAAG,CACZ,EAAU,EACV,IAAuC,EACf,EAAE,CAAC,iBAC3B,EAAE,EACF,EAAE,EAAE,GAAG,EACP,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAC5C,IAAI,EAAE,EAAE,IACL,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC,EACjB,CAAC;AAEH,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,CACxB,eAAK,KAAK,EAAC,IAAI,EAAC,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,gBAAgB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,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7D,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpD,CAAC;AAEF,MAAM,WAAW,GAA8B,KAAK,CAAC,EAAE,CAAC,CACpD,YACI,IAAI,EAAE,KAAK,CAAC,EAAE,EACd,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,CAAC,CAAC,EAAE;QACT,CAAC,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC,EACD,SAAS,EAAE,KAAK,CAAC,SAAS,YAEzB,KAAK,CAAC,QAAQ,GACf,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACtC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,CACH,KAAC,cAAc,IACX,mBAAmB,EAAE,WAAW,EAChC,QAAQ,EAAE,QAAQ,EAClB,
|
|
1
|
+
{"version":3,"file":"side-navigation.stories.js","sourceRoot":"","sources":["../../../src/components/side-navigation/side-navigation.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,MAAM,MAAM,GAAG,CAAC,KAAoB,EAAE,EAAE;IACpC,OAAO,CACH,eAAK,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAClD,KAAC,KAAK,KAAG,EACT,cAAK,SAAS,EAAC,0BAA0B,GAAG,IAC1C,CACT,CAAC;AACN,CAAC,CAAC;AACF,eAAe;IACX,KAAK,EAAE,2BAA2B;IAClC,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,UAAU,EAAE,EAAE;CAC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AC,UAAU;YAChB,KAAK,CAAC,QAAQ;YAEd,KAAK,CAAC,KAAK;YACX,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,SAAS;YAEf,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,OAAO;SAChB,GACH,CACL,CAAC;AACN,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/navigation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Navigation components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"less": true,
|
|
44
44
|
"webpack": false
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "7093c94176a1cf164fbb81e186123625abd87795"
|
|
47
47
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export const IconSideOptions = () => (
|
|
2
|
+
<svg
|
|
3
|
+
width="1em"
|
|
4
|
+
height="1em"
|
|
5
|
+
viewBox="0 0 18 18"
|
|
6
|
+
fill="none"
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M1 3C1 1.89543 1.89543 1 3 1H7V17H3C1.89543 17 1 16.1046 1 15V3Z"
|
|
11
|
+
stroke="currentColor"
|
|
12
|
+
strokeWidth="2"
|
|
13
|
+
strokeOpacity="1"
|
|
14
|
+
/>
|
|
15
|
+
<rect
|
|
16
|
+
x="1"
|
|
17
|
+
y="1"
|
|
18
|
+
width="16"
|
|
19
|
+
height="16"
|
|
20
|
+
rx="2"
|
|
21
|
+
stroke="currentColor"
|
|
22
|
+
strokeWidth="2"
|
|
23
|
+
strokeOpacity="1"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const IconSideSlim = () => (
|
|
29
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
30
|
+
<path
|
|
31
|
+
d="M3 6.375C3 4.51104 4.51104 3 6.375 3H17.625C19.489 3 21 4.51104 21 6.375V17.625C21 19.489 19.489 21 17.625 21H6.375C4.51104 21 3 19.489 3 17.625V6.375Z"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
strokeOpacity="1"
|
|
34
|
+
strokeWidth="2"
|
|
35
|
+
strokeLinecap="round"
|
|
36
|
+
strokeLinejoin="round"
|
|
37
|
+
/>
|
|
38
|
+
<path
|
|
39
|
+
d="M7 8L7 16"
|
|
40
|
+
stroke="currentColor"
|
|
41
|
+
strokeOpacity="1"
|
|
42
|
+
strokeWidth="2"
|
|
43
|
+
strokeLinecap="round"
|
|
44
|
+
/>
|
|
45
|
+
</svg>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
export const IconSideExpanded = () => (
|
|
49
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
50
|
+
<path
|
|
51
|
+
d="M3 6.375C3 4.51104 4.51104 3 6.375 3H17.625C19.489 3 21 4.51104 21 6.375V17.625C21 19.489 19.489 21 17.625 21H6.375C4.51104 21 3 19.489 3 17.625V6.375Z"
|
|
52
|
+
stroke="currentColor"
|
|
53
|
+
strokeOpacity="1"
|
|
54
|
+
strokeWidth="2"
|
|
55
|
+
strokeLinecap="round"
|
|
56
|
+
strokeLinejoin="round"
|
|
57
|
+
/>
|
|
58
|
+
<path
|
|
59
|
+
d="M7 8L7 16"
|
|
60
|
+
stroke="currentColor"
|
|
61
|
+
strokeOpacity="1"
|
|
62
|
+
strokeWidth="2"
|
|
63
|
+
strokeLinecap="round"
|
|
64
|
+
/>
|
|
65
|
+
<path
|
|
66
|
+
d="M11 8V16"
|
|
67
|
+
stroke="currentColor"
|
|
68
|
+
strokeOpacity="1"
|
|
69
|
+
strokeWidth="2"
|
|
70
|
+
strokeLinecap="round"
|
|
71
|
+
/>
|
|
72
|
+
</svg>
|
|
73
|
+
);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/* stylelint-disable no-descending-specificity */
|
|
2
2
|
@import (reference) '@servicetitan/tokens/core/tokens.less';
|
|
3
3
|
|
|
4
|
+
@text-color: #383838;
|
|
5
|
+
@border-color: #c5c5cb;
|
|
6
|
+
|
|
4
7
|
.side-nav {
|
|
5
8
|
display: flex;
|
|
6
9
|
flex-direction: column;
|
|
@@ -12,21 +15,22 @@
|
|
|
12
15
|
transition: width 100ms ease-in-out;
|
|
13
16
|
|
|
14
17
|
background-color: #ebebeb;
|
|
15
|
-
border-right: 1px solid
|
|
18
|
+
border-right: 1px solid @border-color;
|
|
19
|
+
|
|
20
|
+
.side-nav-bottom {
|
|
21
|
+
padding-left: 12px;
|
|
22
|
+
padding-right: 12px;
|
|
16
23
|
|
|
17
|
-
.side-nav-top {
|
|
18
24
|
display: flex;
|
|
19
|
-
flex-direction:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
border-bottom: 1px solid #c5c5cb;
|
|
26
|
-
padding-left: @spacing-1;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
|
|
28
|
+
.sideNavBottomDivider {
|
|
29
|
+
border-top: 1px solid @border-color;
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
&.side-nav-
|
|
33
|
+
&.side-nav-slim {
|
|
30
34
|
width: 56px;
|
|
31
35
|
|
|
32
36
|
.navigation-item-counter {
|
|
@@ -39,27 +43,6 @@
|
|
|
39
43
|
|
|
40
44
|
&.side-nav-expanded {
|
|
41
45
|
width: 240px;
|
|
42
|
-
|
|
43
|
-
.side-nav-top :global(.Button) {
|
|
44
|
-
padding: @spacing-1 !important;
|
|
45
|
-
border-radius: 12px;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
|
|
48
|
-
:global(.Button__content) {
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
white-space: nowrap;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:global(.Button__icon) {
|
|
54
|
-
font-size: 24px;
|
|
55
|
-
padding-left: @spacing-0;
|
|
56
|
-
padding-right: @spacing-1;
|
|
57
|
-
|
|
58
|
-
svg {
|
|
59
|
-
transform: rotateY(180deg);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
46
|
}
|
|
64
47
|
|
|
65
48
|
.side-nav-content {
|
|
@@ -69,6 +52,8 @@
|
|
|
69
52
|
overflow-y: auto;
|
|
70
53
|
margin-top: @spacing-1;
|
|
71
54
|
margin-bottom: @spacing-1;
|
|
55
|
+
flex-grow: 1;
|
|
56
|
+
flex-basis: 0;
|
|
72
57
|
}
|
|
73
58
|
}
|
|
74
59
|
|
|
@@ -88,8 +73,7 @@
|
|
|
88
73
|
border-radius: 12px;
|
|
89
74
|
|
|
90
75
|
&.navigation-item-active {
|
|
91
|
-
color: @color-white
|
|
92
|
-
background-color: @color-neutral-500;
|
|
76
|
+
background-color: @color-white;
|
|
93
77
|
}
|
|
94
78
|
|
|
95
79
|
&:hover:not(.navigation-item-active) {
|
|
@@ -114,3 +98,56 @@
|
|
|
114
98
|
width: 24px;
|
|
115
99
|
font-size: 24px;
|
|
116
100
|
}
|
|
101
|
+
|
|
102
|
+
.options-item {
|
|
103
|
+
font-family: @base-font-family;
|
|
104
|
+
color: @text-color;
|
|
105
|
+
position: relative;
|
|
106
|
+
display: flex;
|
|
107
|
+
justify-content: flex-start;
|
|
108
|
+
align-items: center;
|
|
109
|
+
flex-wrap: nowrap;
|
|
110
|
+
text-wrap: nowrap;
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
height: 32px;
|
|
113
|
+
|
|
114
|
+
margin-top: @spacing-1;
|
|
115
|
+
margin-bottom: @spacing-1;
|
|
116
|
+
border-radius: 8px;
|
|
117
|
+
|
|
118
|
+
&:hover {
|
|
119
|
+
background-color: @color-white;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.options-icon {
|
|
123
|
+
height: 18px;
|
|
124
|
+
width: 18px;
|
|
125
|
+
font-size: 18px;
|
|
126
|
+
padding-left: 7px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.options-item-text {
|
|
130
|
+
font-family: @base-font-family;
|
|
131
|
+
font-size: @typescale-3;
|
|
132
|
+
padding-left: @spacing-2;
|
|
133
|
+
flex: 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.options-popover-item-clickable {
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
|
|
140
|
+
&:hover {
|
|
141
|
+
background-color: @color-neutral-60;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.options-popover-item-active {
|
|
146
|
+
background-color: @color-blue-100;
|
|
147
|
+
color: @color-blue-500;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.options-popover-item-inactive,
|
|
151
|
+
.options-popover-item-active {
|
|
152
|
+
border-radius: @border-radius-1;
|
|
153
|
+
}
|
|
@@ -4,9 +4,16 @@ export const navigationItem: string;
|
|
|
4
4
|
export const navigationItemActive: string;
|
|
5
5
|
export const navigationItemCounter: string;
|
|
6
6
|
export const navigationItemText: string;
|
|
7
|
+
export const optionsIcon: string;
|
|
8
|
+
export const optionsItem: string;
|
|
9
|
+
export const optionsItemText: string;
|
|
10
|
+
export const optionsPopoverItemActive: string;
|
|
11
|
+
export const optionsPopoverItemClickable: string;
|
|
12
|
+
export const optionsPopoverItemInactive: string;
|
|
7
13
|
export const sideNav: string;
|
|
8
|
-
export const
|
|
14
|
+
export const sideNavBottom: string;
|
|
15
|
+
export const sideNavBottomDivider: string;
|
|
9
16
|
export const sideNavContent: string;
|
|
10
17
|
export const sideNavExpanded: string;
|
|
11
|
-
export const
|
|
18
|
+
export const sideNavSlim: string;
|
|
12
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BodyText, Divider, Eyebrow, Icon, Popover, Stack } from '@servicetitan/design-system';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { FC } from 'react';
|
|
3
|
+
import { FC, useState } from 'react';
|
|
4
4
|
import { HeaderNavigationItemData, NavLinkComponentProps } from '../../utils/navigation';
|
|
5
5
|
import {
|
|
6
6
|
DefaultNavLinkComponent,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../../utils/navigation-context';
|
|
10
10
|
import { withTooltip } from '../../utils/with-tooltip';
|
|
11
11
|
import { CounterTag } from '../counter-tag';
|
|
12
|
+
import { IconSideExpanded, IconSideOptions, IconSideSlim } from './icons';
|
|
12
13
|
import * as Styles from './side-navigation.module.less';
|
|
13
14
|
|
|
14
15
|
export interface SideNavigationProps {
|
|
@@ -23,7 +24,7 @@ export interface SideNavigationProps {
|
|
|
23
24
|
/** navigation component used for routing */
|
|
24
25
|
navigationComponent?: FC<NavLinkComponentProps>;
|
|
25
26
|
/** expand change handler */
|
|
26
|
-
|
|
27
|
+
onExpandedChange(expanded: boolean): void;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export const SideNavigation: FC<SideNavigationProps> = ({
|
|
@@ -32,34 +33,31 @@ export const SideNavigation: FC<SideNavigationProps> = ({
|
|
|
32
33
|
id,
|
|
33
34
|
items,
|
|
34
35
|
navigationComponent = DefaultNavLinkComponent,
|
|
35
|
-
|
|
36
|
+
onExpandedChange,
|
|
36
37
|
}) => {
|
|
37
38
|
return (
|
|
38
39
|
<NavLinkContext.Provider value={navigationComponent}>
|
|
39
40
|
<div
|
|
40
41
|
className={classNames(
|
|
41
42
|
Styles.sideNav,
|
|
42
|
-
expanded ? Styles.sideNavExpanded : Styles.
|
|
43
|
+
expanded ? Styles.sideNavExpanded : Styles.sideNavSlim,
|
|
43
44
|
className
|
|
44
45
|
)}
|
|
45
46
|
id={id}
|
|
46
47
|
data-cy="side-navigation"
|
|
47
48
|
>
|
|
48
|
-
<div className={Styles.sideNavTop}>
|
|
49
|
-
<Button
|
|
50
|
-
iconName="keyboard_tab"
|
|
51
|
-
fill="subtle"
|
|
52
|
-
onClick={() => onExpandChange?.(!expanded)}
|
|
53
|
-
aria-label={expanded ? 'Collapse menu' : 'Expand menu'}
|
|
54
|
-
>
|
|
55
|
-
{expanded ? 'Collapse menu' : undefined}
|
|
56
|
-
</Button>
|
|
57
|
-
</div>
|
|
58
49
|
<div className={Styles.sideNavContent} data-cy="navigation-items">
|
|
59
50
|
{items?.map(item => (
|
|
60
51
|
<SideNavigationItem key={item.id} expanded={expanded} {...item} />
|
|
61
52
|
))}
|
|
62
53
|
</div>
|
|
54
|
+
<div className={Styles.sideNavBottom}>
|
|
55
|
+
<div className={Styles.sideNavBottomDivider} />
|
|
56
|
+
<SideNavigationOptions
|
|
57
|
+
expanded={expanded}
|
|
58
|
+
onExpandedChange={onExpandedChange}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
63
61
|
</div>
|
|
64
62
|
</NavLinkContext.Provider>
|
|
65
63
|
);
|
|
@@ -116,3 +114,92 @@ export const SideNavigationItem: FC<SideNavigationItemProps> = ({
|
|
|
116
114
|
'r'
|
|
117
115
|
);
|
|
118
116
|
};
|
|
117
|
+
|
|
118
|
+
/** Side Navigation options item */
|
|
119
|
+
export const SideNavigationOptions: FC<{
|
|
120
|
+
expanded?: boolean;
|
|
121
|
+
onExpandedChange(expanded: boolean): void;
|
|
122
|
+
}> = ({ expanded, onExpandedChange }) => {
|
|
123
|
+
const [open, setOpen] = useState(false);
|
|
124
|
+
|
|
125
|
+
const trigger = withTooltip(
|
|
126
|
+
<div
|
|
127
|
+
data-cy="navigation-left-options"
|
|
128
|
+
data-pendo="navigation-left-options"
|
|
129
|
+
className={classNames(Styles.optionsItem)}
|
|
130
|
+
onClick={() => setOpen(!open)}
|
|
131
|
+
>
|
|
132
|
+
<div className={Styles.optionsIcon}>
|
|
133
|
+
<IconSideOptions />
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
{!!expanded && <span className={Styles.optionsItemText}>Menu Options</span>}
|
|
137
|
+
</div>,
|
|
138
|
+
open || expanded ? undefined : 'Menu Options',
|
|
139
|
+
'r'
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const onExpand = () => {
|
|
143
|
+
setOpen(false);
|
|
144
|
+
onExpandedChange(true);
|
|
145
|
+
};
|
|
146
|
+
const onCollapse = () => {
|
|
147
|
+
setOpen(false);
|
|
148
|
+
onExpandedChange(false);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<Popover
|
|
153
|
+
className="bg-neutral-30"
|
|
154
|
+
trigger={trigger}
|
|
155
|
+
direction="tr"
|
|
156
|
+
onClickOutside={() => setOpen(false)}
|
|
157
|
+
open={open}
|
|
158
|
+
padding="s"
|
|
159
|
+
width="xs"
|
|
160
|
+
>
|
|
161
|
+
<Eyebrow className="p-l-2">menu options</Eyebrow>
|
|
162
|
+
<SideNavigationOptionsItem
|
|
163
|
+
active={!expanded}
|
|
164
|
+
icon={IconSideSlim}
|
|
165
|
+
title="Slim"
|
|
166
|
+
onClick={onCollapse}
|
|
167
|
+
/>
|
|
168
|
+
<SideNavigationOptionsItem
|
|
169
|
+
active={!!expanded}
|
|
170
|
+
icon={IconSideExpanded}
|
|
171
|
+
title="Expanded"
|
|
172
|
+
onClick={onExpand}
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
<Divider className="m-x-half m-y-1" />
|
|
176
|
+
|
|
177
|
+
<SideNavigationOptionsItem
|
|
178
|
+
active={false}
|
|
179
|
+
icon={expanded ? IconSideExpanded : IconSideSlim}
|
|
180
|
+
title={expanded ? 'Expanded' : 'Slim'}
|
|
181
|
+
/>
|
|
182
|
+
</Popover>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const SideNavigationOptionsItem: FC<{
|
|
187
|
+
active: boolean;
|
|
188
|
+
icon: FC;
|
|
189
|
+
title: string;
|
|
190
|
+
onClick?: () => void;
|
|
191
|
+
}> = ({ active, onClick, title, icon: IconComponent }) => (
|
|
192
|
+
<Stack
|
|
193
|
+
className={classNames(
|
|
194
|
+
active ? Styles.optionsPopoverItemActive : Styles.optionsPopoverItemInactive,
|
|
195
|
+
'p-y-1 p-x-2',
|
|
196
|
+
{ [Styles.optionsPopoverItemClickable]: onClick && !active }
|
|
197
|
+
)}
|
|
198
|
+
alignItems="center"
|
|
199
|
+
onClick={!active && onClick}
|
|
200
|
+
>
|
|
201
|
+
<IconComponent />
|
|
202
|
+
<BodyText className="c-inherit m-l-1 flex-grow-1 flex-basis-0">{title}</BodyText>
|
|
203
|
+
{active && <Icon name="check" />}
|
|
204
|
+
</Stack>
|
|
205
|
+
);
|