@servicetitan/navigation 4.0.0 → 5.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/counter-tag.js +1 -1
- package/dist/components/counter-tag.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.d.ts +0 -7
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.js +6 -7
- package/dist/components/header-navigation/header-navigation-content.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts +9 -0
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts.map +1 -0
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.js +13 -0
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.js.map +1 -0
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +5 -6
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +19 -11
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +2 -31
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +11 -30
- package/dist/components/header-navigation/header-navigation-links.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts +3 -3
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js +9 -8
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.d.ts +1 -28
- package/dist/components/header-navigation/header-navigation.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.js +9 -24
- package/dist/components/header-navigation/header-navigation.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.module.less +2 -84
- package/dist/components/header-navigation/header-navigation.stories.d.ts +3 -3
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js +9 -8
- package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
- package/dist/components/header-navigation/index.d.ts +0 -1
- package/dist/components/header-navigation/index.d.ts.map +1 -1
- package/dist/components/header-navigation/index.js +0 -1
- package/dist/components/header-navigation/index.js.map +1 -1
- package/dist/components/layout.stories.js +3 -3
- package/dist/components/layout.stories.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts +9 -0
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts.map +1 -0
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.js +13 -0
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.js.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +18 -0
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny-links.js +30 -0
- package/dist/components/left-navigation/header-navigation-tiny-links.js.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny.d.ts +23 -0
- package/dist/components/left-navigation/header-navigation-tiny.d.ts.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny.js +7 -0
- package/dist/components/left-navigation/header-navigation-tiny.js.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny.module.less +117 -0
- package/dist/components/{header-navigation → left-navigation}/header-navigation-tiny.stories.d.ts +2 -2
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny.stories.js +30 -0
- package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +1 -0
- package/dist/components/left-navigation/index.d.ts +3 -0
- package/dist/components/left-navigation/index.d.ts.map +1 -0
- package/dist/components/left-navigation/index.js +3 -0
- package/dist/components/left-navigation/index.js.map +1 -0
- package/dist/components/{side-navigation → left-navigation}/side-navigation.d.ts.map +1 -1
- package/dist/components/{side-navigation → left-navigation}/side-navigation.js +2 -2
- package/dist/components/left-navigation/side-navigation.js.map +1 -0
- package/dist/components/{side-navigation → left-navigation}/side-navigation.module.less +3 -3
- package/dist/components/{side-navigation → left-navigation}/side-navigation.stories.d.ts +0 -1
- package/dist/components/left-navigation/side-navigation.stories.d.ts.map +1 -0
- package/dist/components/{side-navigation → left-navigation}/side-navigation.stories.js +1 -1
- package/dist/components/{side-navigation → left-navigation}/side-navigation.stories.js.map +1 -1
- package/dist/components/links.d.ts +5 -0
- package/dist/components/links.d.ts.map +1 -0
- package/dist/components/links.js +14 -0
- package/dist/components/links.js.map +1 -0
- package/dist/components/logo/logo-titan.js +1 -1
- package/dist/components/logo/logo-titan.js.map +1 -1
- package/dist/components/logo/logo.stories.d.ts +6 -6
- package/dist/components/logo/logo.stories.d.ts.map +1 -1
- package/dist/components/logo/logo.stories.js +6 -6
- package/dist/components/logo/logo.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js +4 -4
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js +5 -5
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +9 -22
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +9 -0
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +3 -3
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/test/data-stories.module.less +5 -3
- package/dist/test/{data.stories.d.ts → data.d.ts} +1 -2
- package/dist/test/data.d.ts.map +1 -0
- package/dist/test/{data.stories.js → data.js} +16 -19
- package/dist/test/data.js.map +1 -0
- package/dist/utils/navigation-context.d.ts +2 -5
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js +3 -19
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation.d.ts +46 -0
- package/dist/utils/navigation.d.ts.map +1 -1
- package/dist/utils/with-tooltip.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/header-navigation/header-navigation-content.tsx +10 -38
- package/src/components/header-navigation/header-navigation-extra-stacked.stories.tsx +19 -0
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +84 -52
- package/src/components/header-navigation/header-navigation-links.tsx +13 -55
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +6 -8
- package/src/components/header-navigation/header-navigation.module.less +2 -84
- package/src/components/header-navigation/header-navigation.module.less.d.ts +0 -3
- package/src/components/header-navigation/header-navigation.stories.tsx +6 -8
- package/src/components/header-navigation/header-navigation.tsx +7 -120
- package/src/components/header-navigation/index.ts +0 -1
- package/src/components/layout.stories.tsx +3 -3
- package/src/components/left-navigation/header-navigation-extra-tiny.stories.tsx +21 -0
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +134 -0
- package/src/components/left-navigation/header-navigation-tiny.module.less +117 -0
- package/src/components/left-navigation/header-navigation-tiny.module.less.d.ts +15 -0
- package/src/components/{header-navigation → left-navigation}/header-navigation-tiny.stories.tsx +5 -13
- package/src/components/left-navigation/header-navigation-tiny.tsx +65 -0
- package/src/components/left-navigation/index.ts +2 -0
- package/src/components/{side-navigation → left-navigation}/side-navigation.module.less +3 -3
- package/src/components/{side-navigation → left-navigation}/side-navigation.module.less.d.ts +1 -0
- package/src/components/{side-navigation → left-navigation}/side-navigation.stories.tsx +1 -1
- package/src/components/{side-navigation → left-navigation}/side-navigation.tsx +2 -2
- package/src/components/links.tsx +31 -0
- package/src/components/logo/logo.stories.tsx +6 -6
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +14 -6
- package/src/components/profile-dropdown/profile-dropdown-tiny.stories.tsx +15 -5
- package/src/components/profile-dropdown/profile-dropdown.module.less +9 -0
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +1 -0
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +3 -3
- package/src/components/profile-dropdown/profile-dropdown.tsx +7 -4
- package/src/index.ts +3 -1
- package/src/test/data-stories.module.less +5 -3
- package/src/test/{data.stories.tsx → data.tsx} +5 -2
- package/src/utils/navigation-context.tsx +3 -8
- package/src/utils/navigation.ts +51 -0
- package/dist/components/header-navigation/header-navigation-tiny.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-tiny.stories.js +0 -29
- package/dist/components/header-navigation/header-navigation-tiny.stories.js.map +0 -1
- package/dist/components/side-navigation/icons.d.ts +0 -7
- package/dist/components/side-navigation/icons.d.ts.map +0 -1
- package/dist/components/side-navigation/icons.js +0 -5
- package/dist/components/side-navigation/icons.js.map +0 -1
- package/dist/components/side-navigation/index.d.ts +0 -2
- package/dist/components/side-navigation/index.d.ts.map +0 -1
- package/dist/components/side-navigation/index.js +0 -2
- package/dist/components/side-navigation/index.js.map +0 -1
- package/dist/components/side-navigation/side-navigation.js.map +0 -1
- package/dist/components/side-navigation/side-navigation.stories.d.ts.map +0 -1
- package/dist/test/data.stories.d.ts.map +0 -1
- package/dist/test/data.stories.js.map +0 -1
- package/src/components/side-navigation/icons.tsx +0 -74
- package/src/components/side-navigation/index.ts +0 -1
- /package/dist/components/{side-navigation → left-navigation}/side-navigation.d.ts +0 -0
|
@@ -1,66 +1,57 @@
|
|
|
1
|
+
import SvgHelp from '@servicetitan/anvil2/assets/icons/material/round/help_outline.svg';
|
|
2
|
+
import SvgPhone from '@servicetitan/anvil2/assets/icons/material/round/phone.svg';
|
|
3
|
+
import SvgSearch from '@servicetitan/anvil2/assets/icons/material/round/search.svg';
|
|
1
4
|
import { Button, Popover } from '@servicetitan/design-system';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { Fragment, useState } from 'react';
|
|
6
|
+
import { withAnvil, withMemoryRouter } from '../../test/data';
|
|
7
|
+
import { HeaderNavigationLink, HeaderNavigationTrigger } from '../links';
|
|
8
|
+
import { HeaderNavigation } from './';
|
|
9
|
+
|
|
10
|
+
const withHeaderNavigation = (Story: any) => (
|
|
11
|
+
<HeaderNavigation rightClassName="m-r-1">
|
|
12
|
+
<Story />
|
|
13
|
+
</HeaderNavigation>
|
|
14
|
+
);
|
|
10
15
|
|
|
11
16
|
export default {
|
|
12
|
-
title: 'Navigation/
|
|
17
|
+
title: 'Navigation/Extra/Legacy',
|
|
13
18
|
component: HeaderNavigationLink,
|
|
14
|
-
decorators: [withMemoryRouter, withAnvil],
|
|
19
|
+
decorators: [withHeaderNavigation, withMemoryRouter, withAnvil],
|
|
15
20
|
parameters: {},
|
|
16
21
|
};
|
|
17
22
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
iconActive={SvgIcon}
|
|
29
|
-
hint="Search: for all the questions"
|
|
30
|
-
/>
|
|
31
|
-
</HeaderNavigation>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export const extraTrigger = () => (
|
|
35
|
-
<HeaderNavigation items={[]} navigationComponent={NavLinkMock} rightClassName="m-r-1">
|
|
36
|
-
<HeaderNavigationTrigger
|
|
37
|
-
id="dialpad"
|
|
38
|
-
iconName="phone"
|
|
39
|
-
counter={2}
|
|
40
|
-
tooltip="Phones pro"
|
|
41
|
-
icon={SvgIcon}
|
|
42
|
-
iconActive={SvgIcon}
|
|
43
|
-
/>
|
|
44
|
-
</HeaderNavigation>
|
|
23
|
+
export const ExtraLink = () => (
|
|
24
|
+
<HeaderNavigationLink
|
|
25
|
+
id="search"
|
|
26
|
+
to="https://google.com"
|
|
27
|
+
target="_blank"
|
|
28
|
+
iconName="search"
|
|
29
|
+
icon={SvgSearch}
|
|
30
|
+
iconActive={undefined}
|
|
31
|
+
hint="Search: for all the questions"
|
|
32
|
+
/>
|
|
45
33
|
);
|
|
46
34
|
|
|
47
|
-
export const
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
export const ExtraTrigger = () => (
|
|
36
|
+
<HeaderNavigationTrigger
|
|
37
|
+
id="dialpad"
|
|
38
|
+
iconName="phone"
|
|
39
|
+
counter={2}
|
|
40
|
+
tooltip="Phones pro"
|
|
41
|
+
icon={SvgPhone}
|
|
42
|
+
iconActive={undefined}
|
|
43
|
+
/>
|
|
53
44
|
);
|
|
54
45
|
|
|
55
|
-
export const
|
|
56
|
-
<
|
|
46
|
+
export const ExtraWithTooltip = () => (
|
|
47
|
+
<Fragment>
|
|
57
48
|
<HeaderNavigationLink
|
|
58
49
|
id="search"
|
|
59
50
|
to="https://google.com"
|
|
60
51
|
target="_blank"
|
|
61
52
|
iconName="search"
|
|
62
|
-
icon={
|
|
63
|
-
iconActive={
|
|
53
|
+
icon={SvgSearch}
|
|
54
|
+
iconActive={undefined}
|
|
64
55
|
tooltip="Search: for all the questions"
|
|
65
56
|
hint="Google"
|
|
66
57
|
/>
|
|
@@ -68,14 +59,14 @@ export const extraWithTooltip = () => (
|
|
|
68
59
|
<HeaderNavigationTrigger
|
|
69
60
|
id="dialpad"
|
|
70
61
|
iconName="phone"
|
|
71
|
-
|
|
62
|
+
hint="Dialpad"
|
|
72
63
|
counter={2}
|
|
73
|
-
icon={
|
|
74
|
-
iconActive={
|
|
64
|
+
icon={SvgPhone}
|
|
65
|
+
iconActive={undefined}
|
|
75
66
|
/>
|
|
76
67
|
|
|
77
68
|
<HelpCenterButton />
|
|
78
|
-
</
|
|
69
|
+
</Fragment>
|
|
79
70
|
);
|
|
80
71
|
|
|
81
72
|
const HelpCenterButton = () => {
|
|
@@ -89,7 +80,7 @@ const HelpCenterButton = () => {
|
|
|
89
80
|
width="xs"
|
|
90
81
|
trigger={
|
|
91
82
|
<Button
|
|
92
|
-
className="c-
|
|
83
|
+
className="c-inherit"
|
|
93
84
|
iconName="help_outline"
|
|
94
85
|
fill="subtle"
|
|
95
86
|
onClick={() => setOpen(true)}
|
|
@@ -101,3 +92,44 @@ const HelpCenterButton = () => {
|
|
|
101
92
|
</Popover>
|
|
102
93
|
);
|
|
103
94
|
};
|
|
95
|
+
|
|
96
|
+
const HelpTrigger = () => {
|
|
97
|
+
const [active, setActive] = useState(true);
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<HeaderNavigationTrigger
|
|
101
|
+
id="help"
|
|
102
|
+
iconName="help_outline"
|
|
103
|
+
hint="Help"
|
|
104
|
+
icon={SvgHelp}
|
|
105
|
+
iconActive={undefined}
|
|
106
|
+
label="Live Chat"
|
|
107
|
+
onClick={() => setActive(!active)}
|
|
108
|
+
isActive={active}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
export const ExtraWithLabel = () => (
|
|
113
|
+
<Fragment>
|
|
114
|
+
<HeaderNavigationLink
|
|
115
|
+
id="search"
|
|
116
|
+
to="https://google.com"
|
|
117
|
+
target="_blank"
|
|
118
|
+
iconName="search"
|
|
119
|
+
icon={SvgSearch}
|
|
120
|
+
iconActive={undefined}
|
|
121
|
+
tooltip="Search: for all the questions"
|
|
122
|
+
hint="Google"
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<HelpTrigger />
|
|
126
|
+
<HeaderNavigationTrigger
|
|
127
|
+
id="dialpad"
|
|
128
|
+
iconName="phone"
|
|
129
|
+
hint="Dialpad"
|
|
130
|
+
counter={2}
|
|
131
|
+
icon={SvgPhone}
|
|
132
|
+
iconActive={undefined}
|
|
133
|
+
/>
|
|
134
|
+
</Fragment>
|
|
135
|
+
);
|
|
@@ -1,47 +1,11 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { FC,
|
|
3
|
-
import {
|
|
2
|
+
import { FC, ReactNode, useContext } from 'react';
|
|
3
|
+
import { HeaderNavigationLinkProps, HeaderNavigationTriggerProps } from '../../utils/navigation';
|
|
4
|
+
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
4
5
|
import { withTooltip } from '../../utils/with-tooltip';
|
|
5
|
-
import {
|
|
6
|
-
HeaderNavigationItemContent,
|
|
7
|
-
HeaderNavigationItemContentPropsStrict,
|
|
8
|
-
} from './header-navigation-content';
|
|
6
|
+
import { HeaderNavigationItemContent } from './header-navigation-content';
|
|
9
7
|
import * as Styles from './header-navigation.module.less';
|
|
10
8
|
|
|
11
|
-
export interface HeaderNavigationTriggerPropsStrict
|
|
12
|
-
extends Omit<HeaderNavigationItemContentPropsStrict, 'title' | 'isLegacy'> {
|
|
13
|
-
/** unique identifier */
|
|
14
|
-
id: string;
|
|
15
|
-
/** tooltip text */
|
|
16
|
-
tooltip?: string;
|
|
17
|
-
/** item description */
|
|
18
|
-
hint?: string;
|
|
19
|
-
/** container class name */
|
|
20
|
-
className?: string;
|
|
21
|
-
/** isActive */
|
|
22
|
-
isActive?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStrict {
|
|
26
|
-
/** unstrict props */
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface HeaderNavigationLinkPropsStrict
|
|
31
|
-
extends Omit<HeaderNavigationTriggerPropsStrict, 'isActive'> {
|
|
32
|
-
/** link href */
|
|
33
|
-
to: string;
|
|
34
|
-
/** isActive */
|
|
35
|
-
isActive?: boolean | ((pathname: string) => boolean);
|
|
36
|
-
/** link html target */
|
|
37
|
-
target?: HTMLAttributeAnchorTarget;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface HeaderNavigationLinkProps extends HeaderNavigationLinkPropsStrict {
|
|
41
|
-
/** unstrict props */
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
9
|
/** Navigation extra item with link */
|
|
46
10
|
export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
47
11
|
id,
|
|
@@ -53,13 +17,13 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
53
17
|
iconClassName,
|
|
54
18
|
iconComponent,
|
|
55
19
|
iconName,
|
|
56
|
-
icon,
|
|
57
|
-
iconActive,
|
|
58
20
|
isActive,
|
|
21
|
+
label,
|
|
22
|
+
labelClassName,
|
|
59
23
|
target,
|
|
60
24
|
...rest
|
|
61
25
|
}) => {
|
|
62
|
-
const
|
|
26
|
+
const NavigationComponent = useContext(NavigationComponentContext);
|
|
63
27
|
|
|
64
28
|
return withTooltip(
|
|
65
29
|
<NavigationComponent
|
|
@@ -71,7 +35,6 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
71
35
|
title={hint}
|
|
72
36
|
className={classNames(Styles.navigationLink, Styles.navigationItem, className, {
|
|
73
37
|
[Styles.navigationItemActive]: isActive === true,
|
|
74
|
-
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
75
38
|
})}
|
|
76
39
|
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
77
40
|
activeClassName={Styles.navigationItemActive}
|
|
@@ -82,9 +45,8 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
82
45
|
iconComponent={iconComponent}
|
|
83
46
|
iconClassName={iconClassName}
|
|
84
47
|
iconName={iconName}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
isLegacy={isLegacy}
|
|
48
|
+
title={label}
|
|
49
|
+
titleClassName={labelClassName}
|
|
88
50
|
/>
|
|
89
51
|
</NavigationComponent>,
|
|
90
52
|
tooltip
|
|
@@ -99,15 +61,13 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
99
61
|
iconClassName,
|
|
100
62
|
iconComponent,
|
|
101
63
|
iconName,
|
|
102
|
-
icon,
|
|
103
|
-
iconActive,
|
|
104
64
|
isActive,
|
|
65
|
+
label,
|
|
66
|
+
labelClassName,
|
|
105
67
|
hint,
|
|
106
68
|
tooltip,
|
|
107
69
|
...rest
|
|
108
70
|
}) => {
|
|
109
|
-
const { isLegacy } = useContext(NavigationContext);
|
|
110
|
-
|
|
111
71
|
return withTooltip(
|
|
112
72
|
<div
|
|
113
73
|
data-cy={`navigation-trigger-${id}`}
|
|
@@ -119,7 +79,6 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
119
79
|
Styles.navigationLink,
|
|
120
80
|
{
|
|
121
81
|
[Styles.navigationItemActive]: isActive === true,
|
|
122
|
-
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
123
82
|
},
|
|
124
83
|
'cursor-pointer',
|
|
125
84
|
className
|
|
@@ -130,9 +89,8 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
130
89
|
iconComponent={iconComponent}
|
|
131
90
|
iconClassName={iconClassName}
|
|
132
91
|
iconName={iconName}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
isLegacy={isLegacy}
|
|
92
|
+
title={label}
|
|
93
|
+
titleClassName={labelClassName}
|
|
136
94
|
/>
|
|
137
95
|
</div>,
|
|
138
96
|
tooltip
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Input, Stack } from '@servicetitan/design-system';
|
|
2
2
|
import { FC, Fragment } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { SearchIcon, items, withMemoryRouter } from '../../test/data';
|
|
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';
|
|
7
|
+
import { HeaderNavigationLink, HeaderNavigationTrigger } from './header-navigation-links';
|
|
7
8
|
import * as Styles from './header-navigation-stories.module.less';
|
|
8
|
-
import {
|
|
9
|
+
import { HeaderNavigationStacked } from './';
|
|
9
10
|
|
|
10
11
|
export default {
|
|
11
12
|
title: 'Navigation/HeaderNavigationStacked',
|
|
@@ -16,7 +17,7 @@ export default {
|
|
|
16
17
|
|
|
17
18
|
const SvgIcon = undefined as any;
|
|
18
19
|
|
|
19
|
-
export const
|
|
20
|
+
export const DefaultNavigation = () => (
|
|
20
21
|
<HeaderNavigationStacked
|
|
21
22
|
left={<LogoCompanyTitle className="m-l-1" fill="#fff" size="150" />}
|
|
22
23
|
leftClassName="d-f align-items-center"
|
|
@@ -28,11 +29,10 @@ export const defaultNavigation = () => (
|
|
|
28
29
|
items.dispatch,
|
|
29
30
|
items.fleet,
|
|
30
31
|
]}
|
|
31
|
-
navigationComponent={NavLinkMock}
|
|
32
32
|
/>
|
|
33
33
|
);
|
|
34
34
|
|
|
35
|
-
export const
|
|
35
|
+
export const WithLogoTextAndOverflow = () => (
|
|
36
36
|
<HeaderNavigationStacked
|
|
37
37
|
left={
|
|
38
38
|
<Stack alignItems="center">
|
|
@@ -50,7 +50,6 @@ export const withLogoTextAndOverflow = () => (
|
|
|
50
50
|
items.fleet,
|
|
51
51
|
]}
|
|
52
52
|
itemsOverflow={[items.calls, items.accounting, items.purchasing, items.dispatch]}
|
|
53
|
-
navigationComponent={NavLinkMock}
|
|
54
53
|
/>
|
|
55
54
|
);
|
|
56
55
|
|
|
@@ -60,7 +59,7 @@ const TimeZoneOffset: FC = () => (
|
|
|
60
59
|
</div>
|
|
61
60
|
);
|
|
62
61
|
|
|
63
|
-
export const
|
|
62
|
+
export const WithAllMonolithData = () => (
|
|
64
63
|
<HeaderNavigationStacked
|
|
65
64
|
left={<LogoCompanyTitle className="m-l-1" fill="#fff" size="150" />}
|
|
66
65
|
leftClassName="d-f align-items-center"
|
|
@@ -80,7 +79,6 @@ export const withAllMonolithData = () => (
|
|
|
80
79
|
items.pointOfSale,
|
|
81
80
|
items.reports,
|
|
82
81
|
]}
|
|
83
|
-
navigationComponent={NavLinkMock}
|
|
84
82
|
right={
|
|
85
83
|
<Fragment>
|
|
86
84
|
<TimeZoneOffset />
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
|
|
66
66
|
.navigation-link {
|
|
67
67
|
padding: @spacing-2 @spacing-1;
|
|
68
|
+
font-size: 24px;
|
|
68
69
|
|
|
69
70
|
.navigation-item-counter {
|
|
70
71
|
top: 8px;
|
|
@@ -171,6 +172,7 @@
|
|
|
171
172
|
|
|
172
173
|
.navigation-link {
|
|
173
174
|
padding: 12px @spacing-1;
|
|
175
|
+
font-size: @typescale-4;
|
|
174
176
|
|
|
175
177
|
.navigation-item-counter {
|
|
176
178
|
top: 8px;
|
|
@@ -193,86 +195,6 @@
|
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
|
|
196
|
-
@size-links-tiny: 24px;
|
|
197
|
-
|
|
198
|
-
.header-tiny {
|
|
199
|
-
display: grid;
|
|
200
|
-
grid-template-columns: repeat(3, 1fr);
|
|
201
|
-
grid-template-rows: 48px;
|
|
202
|
-
|
|
203
|
-
background-color: @color-white;
|
|
204
|
-
color: @color-black;
|
|
205
|
-
|
|
206
|
-
& > * {
|
|
207
|
-
overflow-y: hidden;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.he-top-left {
|
|
211
|
-
grid-column: span 1;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.he-top-center {
|
|
215
|
-
grid-column: span 1;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.he-top-right {
|
|
219
|
-
grid-column: span 1;
|
|
220
|
-
|
|
221
|
-
.navigation-icon {
|
|
222
|
-
height: @size-links-tiny;
|
|
223
|
-
width: @size-links-tiny;
|
|
224
|
-
font-size: @size-links-tiny;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
& > * {
|
|
228
|
-
color: @color-black;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
:global(.profile-dropdown-image) {
|
|
233
|
-
height: 24px;
|
|
234
|
-
width: 24px;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
:global(.profile-dropdown-trigger) {
|
|
238
|
-
height: 32px;
|
|
239
|
-
font-size: @size-links-tiny;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.navigation-item-counter {
|
|
243
|
-
font-size: 8px !important;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.navigation-link {
|
|
247
|
-
margin: 6px 2px;
|
|
248
|
-
padding: 6px 6px;
|
|
249
|
-
border-radius: 12px;
|
|
250
|
-
|
|
251
|
-
&.navigation-item-active:not(.navigation-item-overflow) {
|
|
252
|
-
background-color: @color-blue-100 !important;
|
|
253
|
-
color: @color-blue-500 !important;
|
|
254
|
-
}
|
|
255
|
-
&:hover:not(.navigation-item-active):not(.navigation-item-overflow) {
|
|
256
|
-
background-color: rgba(0, 0, 0, 0.12) !important;
|
|
257
|
-
}
|
|
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
|
-
|
|
269
|
-
.navigation-item-counter {
|
|
270
|
-
top: 4px;
|
|
271
|
-
right: -2px;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
198
|
.navigation-icon {
|
|
277
199
|
display: inline-block;
|
|
278
200
|
color: inherit;
|
|
@@ -282,10 +204,6 @@
|
|
|
282
204
|
width: 1em;
|
|
283
205
|
font-size: 1em;
|
|
284
206
|
}
|
|
285
|
-
|
|
286
|
-
&.navigation-icon-active {
|
|
287
|
-
display: none;
|
|
288
|
-
}
|
|
289
207
|
}
|
|
290
208
|
|
|
291
209
|
.navigation-item {
|
|
@@ -7,14 +7,11 @@ export const heTopLeft: string;
|
|
|
7
7
|
export const heTopRight: string;
|
|
8
8
|
export const header: string;
|
|
9
9
|
export const headerStacked: string;
|
|
10
|
-
export const headerTiny: string;
|
|
11
10
|
export const navigationIcon: string;
|
|
12
|
-
export const navigationIconActive: string;
|
|
13
11
|
export const navigationItem: string;
|
|
14
12
|
export const navigationItemActive: string;
|
|
15
13
|
export const navigationItemCounter: string;
|
|
16
14
|
export const navigationItemCounterLong: string;
|
|
17
|
-
export const navigationItemIconState: string;
|
|
18
15
|
export const navigationItemMain: string;
|
|
19
16
|
export const navigationItemOverflow: string;
|
|
20
17
|
export const navigationItemTitle: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Popover } from '@servicetitan/design-system';
|
|
2
2
|
import { FC, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { SearchIcon, items, withMemoryRouter } from '../../test/data';
|
|
4
4
|
import { LogoCompanyTitle } from '../logo/logo-company-title';
|
|
5
5
|
import { LogoTitanText } from '../logo/logo-titan-text';
|
|
6
6
|
import { ProfileDropdown } from '../profile-dropdown/profile-dropdown';
|
|
7
|
+
import { HeaderNavigationLink, HeaderNavigationTrigger } from './header-navigation-links';
|
|
7
8
|
import * as Styles from './header-navigation-stories.module.less';
|
|
8
|
-
import { HeaderNavigation
|
|
9
|
+
import { HeaderNavigation } from './';
|
|
9
10
|
|
|
10
11
|
export default {
|
|
11
12
|
title: 'Navigation/HeaderNavigation',
|
|
@@ -15,7 +16,7 @@ export default {
|
|
|
15
16
|
};
|
|
16
17
|
const SvgIcon = undefined as any;
|
|
17
18
|
|
|
18
|
-
export const
|
|
19
|
+
export const DefaultNavigation = () => (
|
|
19
20
|
<HeaderNavigation
|
|
20
21
|
left={<LogoCompanyTitle className="m-l-1" fill="#fff" />}
|
|
21
22
|
items={[
|
|
@@ -26,11 +27,10 @@ export const defaultNavigation = () => (
|
|
|
26
27
|
items.dispatch,
|
|
27
28
|
items.fleet,
|
|
28
29
|
]}
|
|
29
|
-
navigationComponent={NavLinkMock}
|
|
30
30
|
/>
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
-
export const
|
|
33
|
+
export const WithLogoTextAndOverflow = () => (
|
|
34
34
|
<HeaderNavigation
|
|
35
35
|
left={
|
|
36
36
|
<LogoTitanText
|
|
@@ -49,7 +49,6 @@ export const withLogoTextAndOverflow = () => (
|
|
|
49
49
|
items.fleet,
|
|
50
50
|
]}
|
|
51
51
|
itemsOverflow={[items.calls, items.accounting, items.purchasing, items.dispatch]}
|
|
52
|
-
navigationComponent={NavLinkMock}
|
|
53
52
|
/>
|
|
54
53
|
);
|
|
55
54
|
|
|
@@ -84,7 +83,7 @@ const TimeZoneOffset: FC = () => (
|
|
|
84
83
|
</div>
|
|
85
84
|
);
|
|
86
85
|
|
|
87
|
-
export const
|
|
86
|
+
export const WithAllMonolithData = () => (
|
|
88
87
|
<HeaderNavigation
|
|
89
88
|
left={<LogoCompanyTitle className="m-l-1" fill="#fff" />}
|
|
90
89
|
items={[
|
|
@@ -103,7 +102,6 @@ export const withAllMonolithData = () => (
|
|
|
103
102
|
items.pointOfSale,
|
|
104
103
|
items.reports,
|
|
105
104
|
]}
|
|
106
|
-
navigationComponent={NavLinkMock}
|
|
107
105
|
>
|
|
108
106
|
<TimeZoneOffset />
|
|
109
107
|
|