@servicetitan/navigation 3.3.0 → 4.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/header-navigation/header-navigation-content.d.ts +7 -0
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.js +8 -7
- package/dist/components/header-navigation/header-navigation-content.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +3 -2
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +6 -20
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +5 -3
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +12 -6
- package/dist/components/header-navigation/header-navigation-links.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts +1 -0
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js +4 -23
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-tiny.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-tiny.stories.js +11 -7
- package/dist/components/header-navigation/header-navigation-tiny.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.js +17 -5
- package/dist/components/header-navigation/header-navigation.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.module.less +25 -0
- package/dist/components/header-navigation/header-navigation.stories.d.ts +1 -0
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js +5 -24
- package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
- package/dist/components/layout.stories.d.ts +1 -0
- package/dist/components/layout.stories.d.ts.map +1 -1
- package/dist/components/layout.stories.js +2 -0
- package/dist/components/layout.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +2 -8
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js +5 -43
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts +9 -0
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js +13 -0
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +2 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +16 -7
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +7 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts +9 -8
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +39 -39
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +1 -1
- package/dist/components/side-navigation/side-navigation.d.ts +1 -12
- package/dist/components/side-navigation/side-navigation.d.ts.map +1 -1
- package/dist/components/side-navigation/side-navigation.js +10 -24
- package/dist/components/side-navigation/side-navigation.js.map +1 -1
- package/dist/components/side-navigation/side-navigation.module.less +26 -20
- package/dist/components/side-navigation/side-navigation.stories.d.ts +3 -3
- package/dist/components/side-navigation/side-navigation.stories.d.ts.map +1 -1
- package/dist/components/side-navigation/side-navigation.stories.js +2 -23
- package/dist/components/side-navigation/side-navigation.stories.js.map +1 -1
- package/dist/test/data-stories.module.less +6 -0
- package/dist/test/data.stories.d.ts +26 -0
- package/dist/test/data.stories.d.ts.map +1 -0
- package/dist/test/data.stories.js +150 -0
- package/dist/test/data.stories.js.map +1 -0
- package/dist/utils/navigation-context.d.ts +5 -2
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js +20 -5
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation.d.ts +5 -0
- package/dist/utils/navigation.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/components/header-navigation/header-navigation-content.tsx +39 -11
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +24 -21
- package/src/components/header-navigation/header-navigation-links.tsx +36 -8
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +16 -66
- package/src/components/header-navigation/header-navigation-tiny.stories.tsx +37 -41
- package/src/components/header-navigation/header-navigation.module.less +25 -0
- package/src/components/header-navigation/header-navigation.module.less.d.ts +2 -0
- package/src/components/header-navigation/header-navigation.stories.tsx +18 -67
- package/src/components/header-navigation/header-navigation.tsx +45 -8
- package/src/components/layout.stories.tsx +2 -0
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +7 -170
- package/src/components/profile-dropdown/profile-dropdown-tiny.stories.tsx +15 -0
- package/src/components/profile-dropdown/profile-dropdown.module.less +7 -1
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +1 -0
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +106 -129
- package/src/components/profile-dropdown/profile-dropdown.tsx +32 -8
- package/src/components/side-navigation/side-navigation.module.less +26 -20
- package/src/components/side-navigation/side-navigation.module.less.d.ts +2 -3
- package/src/components/side-navigation/side-navigation.stories.tsx +3 -52
- package/src/components/side-navigation/side-navigation.tsx +71 -124
- package/src/test/data-stories.module.less +6 -0
- package/src/test/data-stories.module.less.d.ts +3 -0
- package/src/test/data.stories.tsx +220 -0
- package/src/utils/navigation-context.tsx +15 -10
- package/src/utils/navigation.ts +7 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Icon,
|
|
1
|
+
import { Icon, IconProps } from '@servicetitan/anvil2';
|
|
2
|
+
import { Icon as IconLegacy, IconPropsStrict } from '@servicetitan/design-system';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
|
-
import { FC, Fragment } from 'react';
|
|
4
|
+
import { FC, Fragment, useContext } from 'react';
|
|
4
5
|
import { HeaderNavigationItemData } from '../../utils/navigation';
|
|
5
|
-
import {
|
|
6
|
+
import { NavigationContext } from '../../utils/navigation-context';
|
|
6
7
|
import { withTooltip } from '../../utils/with-tooltip';
|
|
7
8
|
import { CounterTag, CounterTagPropsType } from '../counter-tag';
|
|
8
9
|
import * as Styles from './header-navigation.module.less';
|
|
@@ -22,6 +23,12 @@ export interface HeaderNavigationItemContentPropsStrict {
|
|
|
22
23
|
iconComponent?: FC;
|
|
23
24
|
/** iconName name of anvil icon */
|
|
24
25
|
iconName?: IconPropsStrict['name'];
|
|
26
|
+
/** svg icon (anvil2) of inactive item */
|
|
27
|
+
icon: IconProps['svg'] | undefined;
|
|
28
|
+
/** svg icon (anvil2) of active item */
|
|
29
|
+
iconActive: IconProps['svg'] | undefined;
|
|
30
|
+
/** show legacy icons */
|
|
31
|
+
isLegacy: boolean;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
/** Content for navigation items */
|
|
@@ -33,18 +40,36 @@ export const HeaderNavigationItemContent: FC<HeaderNavigationItemContentPropsStr
|
|
|
33
40
|
iconClassName,
|
|
34
41
|
iconComponent: IconComponent,
|
|
35
42
|
iconName,
|
|
43
|
+
icon,
|
|
44
|
+
iconActive,
|
|
45
|
+
isLegacy,
|
|
36
46
|
}) => {
|
|
37
47
|
const iconClass = classNames(Styles.navigationIcon, iconClassName);
|
|
38
48
|
return (
|
|
39
49
|
<Fragment>
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
{isLegacy ? (
|
|
51
|
+
IconComponent ? (
|
|
52
|
+
<i className={iconClass}>
|
|
53
|
+
<IconComponent />
|
|
54
|
+
</i>
|
|
55
|
+
) : iconName ? (
|
|
56
|
+
<IconLegacy name={iconName} className={iconClass} />
|
|
57
|
+
) : (
|
|
58
|
+
<i className={iconClass} />
|
|
59
|
+
)
|
|
46
60
|
) : (
|
|
47
|
-
<
|
|
61
|
+
<Fragment>
|
|
62
|
+
{!!icon && <Icon svg={icon} className={Styles.navigationIcon} />}
|
|
63
|
+
{!!iconActive && (
|
|
64
|
+
<Icon
|
|
65
|
+
svg={iconActive}
|
|
66
|
+
className={classNames(
|
|
67
|
+
Styles.navigationIcon,
|
|
68
|
+
Styles.navigationIconActive
|
|
69
|
+
)}
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
|
+
</Fragment>
|
|
48
73
|
)}
|
|
49
74
|
|
|
50
75
|
{!!title && (
|
|
@@ -84,7 +109,7 @@ export const HeaderNavigationItem: FC<HeaderNavigationItemPropsStrict> = ({
|
|
|
84
109
|
main,
|
|
85
110
|
minimized,
|
|
86
111
|
}) => {
|
|
87
|
-
const NavigationComponent =
|
|
112
|
+
const { NavigationComponent, isLegacy } = useContext(NavigationContext);
|
|
88
113
|
|
|
89
114
|
return withTooltip(
|
|
90
115
|
<NavigationComponent
|
|
@@ -111,6 +136,9 @@ export const HeaderNavigationItem: FC<HeaderNavigationItemPropsStrict> = ({
|
|
|
111
136
|
iconComponent={iconComponent}
|
|
112
137
|
iconClassName={iconClassName}
|
|
113
138
|
iconName={iconName}
|
|
139
|
+
icon={undefined}
|
|
140
|
+
iconActive={undefined}
|
|
141
|
+
isLegacy={isLegacy}
|
|
114
142
|
/>
|
|
115
143
|
</NavigationComponent>,
|
|
116
144
|
minimized ? title : undefined
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button, Popover } from '@servicetitan/design-system';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { NavLinkMock, withAnvil, withMemoryRouter } from '../../test/data.stories';
|
|
4
4
|
import {
|
|
5
5
|
HeaderNavigation,
|
|
6
6
|
HeaderNavigationLink,
|
|
@@ -11,26 +11,11 @@ import {
|
|
|
11
11
|
export default {
|
|
12
12
|
title: 'Navigation/HeaderNavigationExtra',
|
|
13
13
|
component: HeaderNavigationLink,
|
|
14
|
+
decorators: [withMemoryRouter, withAnvil],
|
|
14
15
|
parameters: {},
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
const
|
|
18
|
-
to,
|
|
19
|
-
children,
|
|
20
|
-
isActive,
|
|
21
|
-
activeClassName,
|
|
22
|
-
...rest
|
|
23
|
-
}) => (
|
|
24
|
-
<a
|
|
25
|
-
{...rest}
|
|
26
|
-
href={to}
|
|
27
|
-
onClick={e => {
|
|
28
|
-
e.preventDefault();
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
{children}
|
|
32
|
-
</a>
|
|
33
|
-
);
|
|
18
|
+
const SvgIcon = undefined as any;
|
|
34
19
|
|
|
35
20
|
export const extraLink = () => (
|
|
36
21
|
<HeaderNavigation items={[]} navigationComponent={NavLinkMock} rightClassName="m-r-1">
|
|
@@ -39,6 +24,8 @@ export const extraLink = () => (
|
|
|
39
24
|
to="https://google.com"
|
|
40
25
|
target="_blank"
|
|
41
26
|
iconName="search"
|
|
27
|
+
icon={SvgIcon}
|
|
28
|
+
iconActive={SvgIcon}
|
|
42
29
|
hint="Search: for all the questions"
|
|
43
30
|
/>
|
|
44
31
|
</HeaderNavigation>
|
|
@@ -46,7 +33,14 @@ export const extraLink = () => (
|
|
|
46
33
|
|
|
47
34
|
export const extraTrigger = () => (
|
|
48
35
|
<HeaderNavigation items={[]} navigationComponent={NavLinkMock} rightClassName="m-r-1">
|
|
49
|
-
<HeaderNavigationTrigger
|
|
36
|
+
<HeaderNavigationTrigger
|
|
37
|
+
id="dialpad"
|
|
38
|
+
iconName="phone"
|
|
39
|
+
counter={2}
|
|
40
|
+
tooltip="Phones pro"
|
|
41
|
+
icon={SvgIcon}
|
|
42
|
+
iconActive={SvgIcon}
|
|
43
|
+
/>
|
|
50
44
|
</HeaderNavigation>
|
|
51
45
|
);
|
|
52
46
|
|
|
@@ -65,11 +59,20 @@ export const extraWithTooltip = () => (
|
|
|
65
59
|
to="https://google.com"
|
|
66
60
|
target="_blank"
|
|
67
61
|
iconName="search"
|
|
62
|
+
icon={SvgIcon}
|
|
63
|
+
iconActive={SvgIcon}
|
|
68
64
|
tooltip="Search: for all the questions"
|
|
69
65
|
hint="Google"
|
|
70
66
|
/>
|
|
71
67
|
|
|
72
|
-
<HeaderNavigationTrigger
|
|
68
|
+
<HeaderNavigationTrigger
|
|
69
|
+
id="dialpad"
|
|
70
|
+
iconName="phone"
|
|
71
|
+
title="Dialpad"
|
|
72
|
+
counter={2}
|
|
73
|
+
icon={SvgIcon}
|
|
74
|
+
iconActive={SvgIcon}
|
|
75
|
+
/>
|
|
73
76
|
|
|
74
77
|
<HelpCenterButton />
|
|
75
78
|
</HeaderNavigation>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { FC, HTMLAttributeAnchorTarget, ReactNode } from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import { FC, HTMLAttributeAnchorTarget, ReactNode, useContext } from 'react';
|
|
3
|
+
import { NavigationContext } from '../../utils/navigation-context';
|
|
4
4
|
import { withTooltip } from '../../utils/with-tooltip';
|
|
5
5
|
import {
|
|
6
6
|
HeaderNavigationItemContent,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import * as Styles from './header-navigation.module.less';
|
|
10
10
|
|
|
11
11
|
export interface HeaderNavigationTriggerPropsStrict
|
|
12
|
-
extends Omit<HeaderNavigationItemContentPropsStrict, 'title' | '
|
|
12
|
+
extends Omit<HeaderNavigationItemContentPropsStrict, 'title' | 'isLegacy'> {
|
|
13
13
|
/** unique identifier */
|
|
14
14
|
id: string;
|
|
15
15
|
/** tooltip text */
|
|
@@ -18,6 +18,8 @@ export interface HeaderNavigationTriggerPropsStrict
|
|
|
18
18
|
hint?: string;
|
|
19
19
|
/** container class name */
|
|
20
20
|
className?: string;
|
|
21
|
+
/** isActive */
|
|
22
|
+
isActive?: boolean;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStrict {
|
|
@@ -25,7 +27,8 @@ interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStric
|
|
|
25
27
|
[key: string]: any;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
export interface HeaderNavigationLinkPropsStrict
|
|
30
|
+
export interface HeaderNavigationLinkPropsStrict
|
|
31
|
+
extends Omit<HeaderNavigationTriggerPropsStrict, 'isActive'> {
|
|
29
32
|
/** link href */
|
|
30
33
|
to: string;
|
|
31
34
|
/** isActive */
|
|
@@ -50,11 +53,13 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
50
53
|
iconClassName,
|
|
51
54
|
iconComponent,
|
|
52
55
|
iconName,
|
|
56
|
+
icon,
|
|
57
|
+
iconActive,
|
|
53
58
|
isActive,
|
|
54
59
|
target,
|
|
55
60
|
...rest
|
|
56
61
|
}) => {
|
|
57
|
-
const NavigationComponent =
|
|
62
|
+
const { NavigationComponent, isLegacy } = useContext(NavigationContext);
|
|
58
63
|
|
|
59
64
|
return withTooltip(
|
|
60
65
|
<NavigationComponent
|
|
@@ -66,6 +71,7 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
66
71
|
title={hint}
|
|
67
72
|
className={classNames(Styles.navigationLink, Styles.navigationItem, className, {
|
|
68
73
|
[Styles.navigationItemActive]: isActive === true,
|
|
74
|
+
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
69
75
|
})}
|
|
70
76
|
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
71
77
|
activeClassName={Styles.navigationItemActive}
|
|
@@ -76,6 +82,9 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
76
82
|
iconComponent={iconComponent}
|
|
77
83
|
iconClassName={iconClassName}
|
|
78
84
|
iconName={iconName}
|
|
85
|
+
icon={icon}
|
|
86
|
+
iconActive={iconActive}
|
|
87
|
+
isLegacy={isLegacy}
|
|
79
88
|
/>
|
|
80
89
|
</NavigationComponent>,
|
|
81
90
|
tooltip
|
|
@@ -90,11 +99,16 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
90
99
|
iconClassName,
|
|
91
100
|
iconComponent,
|
|
92
101
|
iconName,
|
|
102
|
+
icon,
|
|
103
|
+
iconActive,
|
|
104
|
+
isActive,
|
|
93
105
|
hint,
|
|
94
106
|
tooltip,
|
|
95
107
|
...rest
|
|
96
|
-
}) =>
|
|
97
|
-
|
|
108
|
+
}) => {
|
|
109
|
+
const { isLegacy } = useContext(NavigationContext);
|
|
110
|
+
|
|
111
|
+
return withTooltip(
|
|
98
112
|
<div
|
|
99
113
|
data-cy={`navigation-trigger-${id}`}
|
|
100
114
|
data-pendo={`navigation-trigger-${id}`}
|
|
@@ -103,6 +117,10 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
103
117
|
className={classNames(
|
|
104
118
|
Styles.navigationItem,
|
|
105
119
|
Styles.navigationLink,
|
|
120
|
+
{
|
|
121
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
122
|
+
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
123
|
+
},
|
|
106
124
|
'cursor-pointer',
|
|
107
125
|
className
|
|
108
126
|
)}
|
|
@@ -112,16 +130,26 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
112
130
|
iconComponent={iconComponent}
|
|
113
131
|
iconClassName={iconClassName}
|
|
114
132
|
iconName={iconName}
|
|
133
|
+
icon={icon}
|
|
134
|
+
iconActive={iconActive}
|
|
135
|
+
isLegacy={isLegacy}
|
|
115
136
|
/>
|
|
116
137
|
</div>,
|
|
117
138
|
tooltip
|
|
118
139
|
);
|
|
140
|
+
};
|
|
119
141
|
|
|
120
142
|
/** Navigation extra item with custom content */
|
|
121
143
|
export const HeaderNavigationTriggerCustom: FC<
|
|
122
144
|
Omit<
|
|
123
145
|
HeaderNavigationTriggerProps,
|
|
124
|
-
|
|
146
|
+
| 'counter'
|
|
147
|
+
| 'iconSize'
|
|
148
|
+
| 'iconName'
|
|
149
|
+
| 'iconComponent'
|
|
150
|
+
| 'iconClassName'
|
|
151
|
+
| 'icon'
|
|
152
|
+
| 'iconActive'
|
|
125
153
|
> & { children: ReactNode }
|
|
126
154
|
> = ({ children, id, className, tooltip, title, ...rest }) =>
|
|
127
155
|
withTooltip(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Input, Stack } from '@servicetitan/design-system';
|
|
2
2
|
import { FC, Fragment } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { NavLinkMock, SearchIcon, items, withMemoryRouter } from '../../test/data.stories';
|
|
4
4
|
import { LogoCompanyTitle } from '../logo/logo-company-title';
|
|
5
5
|
import { LogoTitan, LogoTitanTitle } from '../logo/logo-titan-text';
|
|
6
6
|
import { ProfileDropdown } from '../profile-dropdown/profile-dropdown';
|
|
@@ -11,72 +11,10 @@ export default {
|
|
|
11
11
|
title: 'Navigation/HeaderNavigationStacked',
|
|
12
12
|
component: HeaderNavigationStacked,
|
|
13
13
|
parameters: {},
|
|
14
|
+
decorators: [withMemoryRouter],
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
id: string,
|
|
18
|
-
data: Partial<HeaderNavigationItemData>
|
|
19
|
-
): HeaderNavigationItemData => ({
|
|
20
|
-
id,
|
|
21
|
-
to: '/',
|
|
22
|
-
title: id[0].toUpperCase() + id.substring(1),
|
|
23
|
-
hint: id,
|
|
24
|
-
...(data ?? {}),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const InventoryIcon = () => (
|
|
28
|
-
<svg width="20" xmlns="http://www.w3.org/2000/svg" viewBox="-293 385 24 24" fill="currentColor">
|
|
29
|
-
<polyline points="-288,400.9 -282,404.3 -282,397.6 -288,394.2 -288,400.9 " />
|
|
30
|
-
<path d="M-272,401.5c0,0.4-0.2,0.7-0.5,0.9l-7.9,4.4c-0.2,0.1-0.4,0.2-0.6,0.2s-0.4-0.1-0.6-0.2l-7.9-4.4c-0.3-0.2-0.5-0.5-0.5-0.9v-9c0-0.4,0.2-0.7,0.5-0.9l7.9-4.4c0.2-0.1,0.4-0.2,0.6-0.2s0.4,0.1,0.6,0.2l7.9,4.4c0.3,0.2,0.5,0.5,0.5,0.9V401.5 M-287,392.5 l6,3.4l5.9-3.3l-5.9-3.4L-287,392.5 M-274,400.9v-6.7l-6,3.4v6.7L-274,400.9z" />
|
|
31
|
-
</svg>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const SearchIcon = () => (
|
|
35
|
-
<svg
|
|
36
|
-
width="1em"
|
|
37
|
-
height="1em"
|
|
38
|
-
viewBox="0 0 24 24"
|
|
39
|
-
fill="none"
|
|
40
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
-
>
|
|
42
|
-
<g transform="translate(0,4)">
|
|
43
|
-
<path
|
|
44
|
-
d="M0 15.7992V13.9992H12V15.7992H0ZM0 9.49922V7.69922H6V9.49922H0ZM0 3.19922V1.39922H6V3.19922H0ZM22.74 15.7992L17.94 10.9992C17.42 11.3992 16.86 11.6992 16.26 11.8992C15.66 12.0992 15.04 12.1992 14.4 12.1992C12.74 12.1992 11.325 11.6142 10.155 10.4442C8.985 9.27422 8.4 7.85922 8.4 6.19922C8.4 4.53922 8.985 3.12422 10.155 1.95422C11.325 0.784219 12.74 0.199219 14.4 0.199219C16.06 0.199219 17.475 0.784219 18.645 1.95422C19.815 3.12422 20.4 4.53922 20.4 6.19922C20.4 6.83922 20.3 7.45922 20.1 8.05922C19.9 8.65922 19.6 9.21922 19.2 9.73922L24 14.5392L22.74 15.7992ZM14.393 10.3992C15.5577 10.3992 16.55 9.99157 17.37 9.17627C18.19 8.36099 18.6 7.37099 18.6 6.20627C18.6 5.04157 18.1923 4.04922 17.377 3.22922C16.5618 2.40922 15.5718 1.99922 14.407 1.99922C13.2423 1.99922 12.25 2.40687 11.43 3.22217C10.61 4.03745 10.2 5.02745 10.2 6.19217C10.2 7.35687 10.6077 8.34922 11.423 9.16922C12.2382 9.98922 13.2282 10.3992 14.393 10.3992Z"
|
|
45
|
-
fill="white"
|
|
46
|
-
/>
|
|
47
|
-
</g>
|
|
48
|
-
</svg>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const items = {
|
|
52
|
-
calendar: getItem('calendar', { iconName: 'event' }),
|
|
53
|
-
calls: getItem('calls', { iconName: 'local_phone', isActive: true, counter: 12 }),
|
|
54
|
-
dashboard: getItem('dashboard', { iconName: 'odometer', isActive: true }),
|
|
55
|
-
dispatch: getItem('dispatch', { iconName: 'location_disabled', counter: 1 }),
|
|
56
|
-
fleet: getItem('fleet', { iconName: 'fleet-pro', title: 'Fleet Pro' }),
|
|
57
|
-
followUps: getItem('followUps', { iconName: 'flag', title: 'Follow Ups' }),
|
|
58
|
-
inventory: getItem('inventory', { iconName: 'toys' }),
|
|
59
|
-
purchasing: getItem('purchasing', { iconComponent: InventoryIcon }),
|
|
60
|
-
accounting: getItem('accounting', { iconName: 'assignment' }),
|
|
61
|
-
marketing: getItem('marketing', { iconName: 'bullhorn' }),
|
|
62
|
-
priceBook: getItem('priceBook', { iconName: 'book' }),
|
|
63
|
-
pointOfSale: getItem('pointOfSale', { iconName: 'cash-register' }),
|
|
64
|
-
projects: getItem('projects', { iconName: 'folder_special' }),
|
|
65
|
-
reports: getItem('reports', { iconName: 'poll' }),
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const NavLinkMock: FC<NavLinkComponentProps> = props => (
|
|
69
|
-
<a
|
|
70
|
-
href={props.to}
|
|
71
|
-
target={props.target}
|
|
72
|
-
onClick={e => {
|
|
73
|
-
e.preventDefault();
|
|
74
|
-
}}
|
|
75
|
-
className={props.className}
|
|
76
|
-
>
|
|
77
|
-
{props.children}
|
|
78
|
-
</a>
|
|
79
|
-
);
|
|
17
|
+
const SvgIcon = undefined as any;
|
|
80
18
|
|
|
81
19
|
export const defaultNavigation = () => (
|
|
82
20
|
<HeaderNavigationStacked
|
|
@@ -153,14 +91,24 @@ export const withAllMonolithData = () => (
|
|
|
153
91
|
target="_blank"
|
|
154
92
|
iconComponent={SearchIcon}
|
|
155
93
|
hint="Search: for all the questions"
|
|
94
|
+
icon={SvgIcon}
|
|
95
|
+
iconActive={SvgIcon}
|
|
156
96
|
/>
|
|
157
97
|
|
|
158
|
-
<HeaderNavigationTrigger
|
|
98
|
+
<HeaderNavigationTrigger
|
|
99
|
+
id="dialpad"
|
|
100
|
+
iconName="phone"
|
|
101
|
+
counter={2}
|
|
102
|
+
icon={SvgIcon}
|
|
103
|
+
iconActive={SvgIcon}
|
|
104
|
+
/>
|
|
159
105
|
|
|
160
106
|
<HeaderNavigationTrigger
|
|
161
107
|
id="titanAdvisor"
|
|
162
108
|
iconName="rocket"
|
|
163
109
|
iconClassName={Styles.rocketIcon}
|
|
110
|
+
icon={SvgIcon}
|
|
111
|
+
iconActive={SvgIcon}
|
|
164
112
|
/>
|
|
165
113
|
|
|
166
114
|
<HeaderNavigationLink
|
|
@@ -171,6 +119,8 @@ export const withAllMonolithData = () => (
|
|
|
171
119
|
aria-label="search"
|
|
172
120
|
hint="Settings"
|
|
173
121
|
isActive
|
|
122
|
+
icon={SvgIcon}
|
|
123
|
+
iconActive={SvgIcon}
|
|
174
124
|
/>
|
|
175
125
|
|
|
176
126
|
<ProfileDropdown>
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
+
import SvgSearch from '@servicetitan/anvil2/assets/icons/material/round/search.svg';
|
|
2
|
+
import SvgSettingsActive from '@servicetitan/anvil2/assets/icons/st/gnav_settings_active.svg';
|
|
3
|
+
import SvgSettings from '@servicetitan/anvil2/assets/icons/st/gnav_settings_inactive.svg';
|
|
4
|
+
import SvgRocketActive from '@servicetitan/anvil2/assets/icons/st/gnav_titan_advisor_active.svg';
|
|
5
|
+
import SvgRocket from '@servicetitan/anvil2/assets/icons/st/gnav_titan_advisor_inactive.svg';
|
|
6
|
+
|
|
1
7
|
import { Input, Stack } from '@servicetitan/design-system';
|
|
2
8
|
import { FC, Fragment } from 'react';
|
|
3
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
CallsNavigationTrigger,
|
|
11
|
+
NavLinkMock,
|
|
12
|
+
SearchIcon,
|
|
13
|
+
withAnvil,
|
|
14
|
+
withMemoryRouter,
|
|
15
|
+
} from '../../test/data.stories';
|
|
4
16
|
import { LogoCompanyTitle } from '../logo/logo-company-title';
|
|
5
17
|
import { LogoTitan, LogoTitanTitle } from '../logo/logo-titan-text';
|
|
6
18
|
import { ProfileDropdown } from '../profile-dropdown/profile-dropdown';
|
|
7
19
|
import * as Styles from './header-navigation-stories.module.less';
|
|
8
|
-
import { HeaderNavigationLink, HeaderNavigationTiny
|
|
20
|
+
import { HeaderNavigationLink, HeaderNavigationTiny } from './';
|
|
9
21
|
|
|
10
22
|
export default {
|
|
11
23
|
title: 'Navigation/HeaderNavigationTiny',
|
|
12
24
|
component: HeaderNavigationTiny,
|
|
13
25
|
parameters: {},
|
|
14
26
|
decorators: [
|
|
27
|
+
withMemoryRouter,
|
|
28
|
+
withAnvil,
|
|
15
29
|
(Story: any) => (
|
|
16
30
|
<div className="border" style={{ height: '500px' }}>
|
|
17
31
|
<Story />
|
|
@@ -20,36 +34,6 @@ export default {
|
|
|
20
34
|
],
|
|
21
35
|
};
|
|
22
36
|
|
|
23
|
-
const SearchIcon = () => (
|
|
24
|
-
<svg
|
|
25
|
-
width="1em"
|
|
26
|
-
height="1em"
|
|
27
|
-
viewBox="0 0 24 24"
|
|
28
|
-
fill="none"
|
|
29
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
-
>
|
|
31
|
-
<g transform="translate(0,4)">
|
|
32
|
-
<path
|
|
33
|
-
d="M0 15.7992V13.9992H12V15.7992H0ZM0 9.49922V7.69922H6V9.49922H0ZM0 3.19922V1.39922H6V3.19922H0ZM22.74 15.7992L17.94 10.9992C17.42 11.3992 16.86 11.6992 16.26 11.8992C15.66 12.0992 15.04 12.1992 14.4 12.1992C12.74 12.1992 11.325 11.6142 10.155 10.4442C8.985 9.27422 8.4 7.85922 8.4 6.19922C8.4 4.53922 8.985 3.12422 10.155 1.95422C11.325 0.784219 12.74 0.199219 14.4 0.199219C16.06 0.199219 17.475 0.784219 18.645 1.95422C19.815 3.12422 20.4 4.53922 20.4 6.19922C20.4 6.83922 20.3 7.45922 20.1 8.05922C19.9 8.65922 19.6 9.21922 19.2 9.73922L24 14.5392L22.74 15.7992ZM14.393 10.3992C15.5577 10.3992 16.55 9.99157 17.37 9.17627C18.19 8.36099 18.6 7.37099 18.6 6.20627C18.6 5.04157 18.1923 4.04922 17.377 3.22922C16.5618 2.40922 15.5718 1.99922 14.407 1.99922C13.2423 1.99922 12.25 2.40687 11.43 3.22217C10.61 4.03745 10.2 5.02745 10.2 6.19217C10.2 7.35687 10.6077 8.34922 11.423 9.16922C12.2382 9.98922 13.2282 10.3992 14.393 10.3992Z"
|
|
34
|
-
fill="currentColor"
|
|
35
|
-
/>
|
|
36
|
-
</g>
|
|
37
|
-
</svg>
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const NavLinkMock: FC<NavLinkComponentProps> = props => (
|
|
41
|
-
<a
|
|
42
|
-
href={props.to}
|
|
43
|
-
target={props.target}
|
|
44
|
-
onClick={e => {
|
|
45
|
-
e.preventDefault();
|
|
46
|
-
}}
|
|
47
|
-
className={props.className}
|
|
48
|
-
>
|
|
49
|
-
{props.children}
|
|
50
|
-
</a>
|
|
51
|
-
);
|
|
52
|
-
|
|
53
37
|
export const defaultNavigation = () => (
|
|
54
38
|
<HeaderNavigationTiny
|
|
55
39
|
className="border-bottom"
|
|
@@ -81,24 +65,31 @@ export const WithAllMonolithData = () => (
|
|
|
81
65
|
target="_blank"
|
|
82
66
|
iconComponent={SearchIcon}
|
|
83
67
|
hint="Search: for all the questions"
|
|
68
|
+
tooltip="Search"
|
|
69
|
+
icon={SvgSearch}
|
|
70
|
+
iconActive={SvgSearch}
|
|
84
71
|
/>
|
|
85
72
|
|
|
86
|
-
<
|
|
73
|
+
<CallsNavigationTrigger />
|
|
87
74
|
|
|
88
|
-
<
|
|
75
|
+
<HeaderNavigationLink
|
|
89
76
|
id="titanAdvisor"
|
|
77
|
+
to="titanAdvisor"
|
|
90
78
|
iconName="rocket"
|
|
91
79
|
iconClassName={Styles.rocketIcon}
|
|
80
|
+
icon={SvgRocket}
|
|
81
|
+
iconActive={SvgRocketActive}
|
|
92
82
|
/>
|
|
93
83
|
|
|
94
84
|
<HeaderNavigationLink
|
|
95
85
|
id="settings"
|
|
96
|
-
to="
|
|
86
|
+
to="settings"
|
|
97
87
|
target="_blank"
|
|
98
88
|
iconName="settings"
|
|
99
89
|
aria-label="search"
|
|
100
90
|
hint="Settings"
|
|
101
|
-
|
|
91
|
+
icon={SvgSettings}
|
|
92
|
+
iconActive={SvgSettingsActive}
|
|
102
93
|
/>
|
|
103
94
|
|
|
104
95
|
<ProfileDropdown>
|
|
@@ -142,24 +133,29 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
142
133
|
target="_blank"
|
|
143
134
|
iconComponent={SearchIcon}
|
|
144
135
|
hint="Search: for all the questions"
|
|
136
|
+
icon={SvgSearch}
|
|
137
|
+
iconActive={SvgSearch}
|
|
145
138
|
/>
|
|
146
139
|
|
|
147
|
-
<
|
|
140
|
+
<CallsNavigationTrigger />
|
|
148
141
|
|
|
149
|
-
<
|
|
142
|
+
<HeaderNavigationLink
|
|
150
143
|
id="titanAdvisor"
|
|
144
|
+
to="titanAdvisor"
|
|
151
145
|
iconName="rocket"
|
|
152
146
|
iconClassName={Styles.rocketIcon}
|
|
147
|
+
icon={SvgRocket}
|
|
148
|
+
iconActive={SvgRocketActive}
|
|
153
149
|
/>
|
|
154
150
|
|
|
155
151
|
<HeaderNavigationLink
|
|
156
152
|
id="settings"
|
|
157
|
-
to="
|
|
158
|
-
target="_blank"
|
|
153
|
+
to="settings"
|
|
159
154
|
iconName="settings"
|
|
160
155
|
aria-label="search"
|
|
161
156
|
hint="Settings"
|
|
162
|
-
|
|
157
|
+
icon={SvgSettings}
|
|
158
|
+
iconActive={SvgSettingsActive}
|
|
163
159
|
/>
|
|
164
160
|
|
|
165
161
|
<ProfileDropdown>
|
|
@@ -256,6 +256,16 @@
|
|
|
256
256
|
background-color: rgba(0, 0, 0, 0.12) !important;
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
&.navigation-item-icon-state.navigation-item-active {
|
|
260
|
+
.navigation-icon:not(.navigation-icon-active) {
|
|
261
|
+
display: none;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.navigation-icon.navigation-icon-active {
|
|
265
|
+
display: block;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
259
269
|
.navigation-item-counter {
|
|
260
270
|
top: 4px;
|
|
261
271
|
right: -2px;
|
|
@@ -265,6 +275,17 @@
|
|
|
265
275
|
|
|
266
276
|
.navigation-icon {
|
|
267
277
|
display: inline-block;
|
|
278
|
+
color: inherit;
|
|
279
|
+
|
|
280
|
+
& > svg {
|
|
281
|
+
height: 1em;
|
|
282
|
+
width: 1em;
|
|
283
|
+
font-size: 1em;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&.navigation-icon-active {
|
|
287
|
+
display: none;
|
|
288
|
+
}
|
|
268
289
|
}
|
|
269
290
|
|
|
270
291
|
.navigation-item {
|
|
@@ -314,3 +335,7 @@
|
|
|
314
335
|
margin-top: -@spacing-1;
|
|
315
336
|
}
|
|
316
337
|
}
|
|
338
|
+
|
|
339
|
+
.navigation-link {
|
|
340
|
+
color: inherit;
|
|
341
|
+
}
|
|
@@ -9,10 +9,12 @@ export const header: string;
|
|
|
9
9
|
export const headerStacked: string;
|
|
10
10
|
export const headerTiny: string;
|
|
11
11
|
export const navigationIcon: string;
|
|
12
|
+
export const navigationIconActive: string;
|
|
12
13
|
export const navigationItem: string;
|
|
13
14
|
export const navigationItemActive: string;
|
|
14
15
|
export const navigationItemCounter: string;
|
|
15
16
|
export const navigationItemCounterLong: string;
|
|
17
|
+
export const navigationItemIconState: string;
|
|
16
18
|
export const navigationItemMain: string;
|
|
17
19
|
export const navigationItemOverflow: string;
|
|
18
20
|
export const navigationItemTitle: string;
|