@servicetitan/navigation 3.3.0 → 4.1.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.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.js +3 -3
- package/dist/components/header-navigation/header-navigation-content.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +3 -3
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +8 -22
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +3 -30
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +8 -5
- 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 +8 -26
- 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 +5 -8
- package/dist/components/header-navigation/header-navigation.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.module.less +13 -70
- 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 +9 -27
- 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.d.ts +1 -0
- package/dist/components/layout.stories.d.ts.map +1 -1
- package/dist/components/layout.stories.js +4 -2
- package/dist/components/layout.stories.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +16 -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 +43 -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 +109 -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 +1 -12
- package/dist/components/left-navigation/side-navigation.d.ts.map +1 -0
- package/dist/components/left-navigation/side-navigation.js +23 -0
- package/dist/components/left-navigation/side-navigation.js.map +1 -0
- package/dist/components/{side-navigation → left-navigation}/side-navigation.module.less +28 -22
- package/dist/components/left-navigation/side-navigation.stories.d.ts +10 -0
- package/dist/components/left-navigation/side-navigation.stories.d.ts.map +1 -0
- package/dist/components/left-navigation/side-navigation.stories.js +31 -0
- package/dist/components/left-navigation/side-navigation.stories.js.map +1 -0
- 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/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/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/test/data-stories.module.less +8 -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 +151 -0
- package/dist/test/data.stories.js.map +1 -0
- package/dist/utils/navigation-context.d.ts +2 -2
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js +18 -5
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation.d.ts +47 -0
- package/dist/utils/navigation.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/components/header-navigation/header-navigation-content.tsx +3 -3
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +29 -38
- package/src/components/header-navigation/header-navigation-links.tsx +19 -41
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +18 -70
- package/src/components/header-navigation/header-navigation.module.less +13 -70
- package/src/components/header-navigation/header-navigation.module.less.d.ts +0 -1
- package/src/components/header-navigation/header-navigation.stories.tsx +20 -71
- package/src/components/header-navigation/header-navigation.tsx +6 -82
- package/src/components/header-navigation/index.ts +0 -1
- package/src/components/layout.stories.tsx +4 -2
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +110 -0
- package/src/components/left-navigation/header-navigation-tiny.module.less +109 -0
- package/src/components/left-navigation/header-navigation-tiny.module.less.d.ts +14 -0
- package/src/components/{header-navigation → left-navigation}/header-navigation-tiny.stories.tsx +39 -46
- 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 +28 -22
- package/src/components/{side-navigation → left-navigation}/side-navigation.module.less.d.ts +3 -3
- package/src/components/left-navigation/side-navigation.stories.tsx +46 -0
- package/src/components/left-navigation/side-navigation.tsx +171 -0
- package/src/components/links.tsx +31 -0
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +5 -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 +35 -8
- package/src/index.ts +2 -1
- package/src/test/data-stories.module.less +8 -0
- package/src/test/data-stories.module.less.d.ts +3 -0
- package/src/test/data.stories.tsx +223 -0
- package/src/utils/navigation-context.tsx +10 -10
- package/src/utils/navigation.ts +54 -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 -25
- 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.d.ts.map +0 -1
- package/dist/components/side-navigation/side-navigation.js +0 -37
- package/dist/components/side-navigation/side-navigation.js.map +0 -1
- package/dist/components/side-navigation/side-navigation.stories.d.ts +0 -10
- package/dist/components/side-navigation/side-navigation.stories.d.ts.map +0 -1
- package/dist/components/side-navigation/side-navigation.stories.js +0 -52
- package/dist/components/side-navigation/side-navigation.stories.js.map +0 -1
- package/src/components/side-navigation/icons.tsx +0 -74
- package/src/components/side-navigation/index.ts +0 -1
- package/src/components/side-navigation/side-navigation.stories.tsx +0 -95
- package/src/components/side-navigation/side-navigation.tsx +0 -224
|
@@ -1,82 +1,21 @@
|
|
|
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.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';
|
|
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',
|
|
12
13
|
component: HeaderNavigationStacked,
|
|
13
14
|
parameters: {},
|
|
15
|
+
decorators: [withMemoryRouter],
|
|
14
16
|
};
|
|
15
17
|
|
|
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
|
-
);
|
|
18
|
+
const SvgIcon = undefined as any;
|
|
80
19
|
|
|
81
20
|
export const defaultNavigation = () => (
|
|
82
21
|
<HeaderNavigationStacked
|
|
@@ -90,7 +29,6 @@ export const defaultNavigation = () => (
|
|
|
90
29
|
items.dispatch,
|
|
91
30
|
items.fleet,
|
|
92
31
|
]}
|
|
93
|
-
navigationComponent={NavLinkMock}
|
|
94
32
|
/>
|
|
95
33
|
);
|
|
96
34
|
|
|
@@ -112,7 +50,6 @@ export const withLogoTextAndOverflow = () => (
|
|
|
112
50
|
items.fleet,
|
|
113
51
|
]}
|
|
114
52
|
itemsOverflow={[items.calls, items.accounting, items.purchasing, items.dispatch]}
|
|
115
|
-
navigationComponent={NavLinkMock}
|
|
116
53
|
/>
|
|
117
54
|
);
|
|
118
55
|
|
|
@@ -142,7 +79,6 @@ export const withAllMonolithData = () => (
|
|
|
142
79
|
items.pointOfSale,
|
|
143
80
|
items.reports,
|
|
144
81
|
]}
|
|
145
|
-
navigationComponent={NavLinkMock}
|
|
146
82
|
right={
|
|
147
83
|
<Fragment>
|
|
148
84
|
<TimeZoneOffset />
|
|
@@ -153,14 +89,24 @@ export const withAllMonolithData = () => (
|
|
|
153
89
|
target="_blank"
|
|
154
90
|
iconComponent={SearchIcon}
|
|
155
91
|
hint="Search: for all the questions"
|
|
92
|
+
icon={SvgIcon}
|
|
93
|
+
iconActive={SvgIcon}
|
|
156
94
|
/>
|
|
157
95
|
|
|
158
|
-
<HeaderNavigationTrigger
|
|
96
|
+
<HeaderNavigationTrigger
|
|
97
|
+
id="dialpad"
|
|
98
|
+
iconName="phone"
|
|
99
|
+
counter={2}
|
|
100
|
+
icon={SvgIcon}
|
|
101
|
+
iconActive={SvgIcon}
|
|
102
|
+
/>
|
|
159
103
|
|
|
160
104
|
<HeaderNavigationTrigger
|
|
161
105
|
id="titanAdvisor"
|
|
162
106
|
iconName="rocket"
|
|
163
107
|
iconClassName={Styles.rocketIcon}
|
|
108
|
+
icon={SvgIcon}
|
|
109
|
+
iconActive={SvgIcon}
|
|
164
110
|
/>
|
|
165
111
|
|
|
166
112
|
<HeaderNavigationLink
|
|
@@ -171,6 +117,8 @@ export const withAllMonolithData = () => (
|
|
|
171
117
|
aria-label="search"
|
|
172
118
|
hint="Settings"
|
|
173
119
|
isActive
|
|
120
|
+
icon={SvgIcon}
|
|
121
|
+
iconActive={SvgIcon}
|
|
174
122
|
/>
|
|
175
123
|
|
|
176
124
|
<ProfileDropdown>
|
|
@@ -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,78 +195,15 @@
|
|
|
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-counter {
|
|
260
|
-
top: 4px;
|
|
261
|
-
right: -2px;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
198
|
.navigation-icon {
|
|
267
199
|
display: inline-block;
|
|
200
|
+
color: inherit;
|
|
201
|
+
|
|
202
|
+
& > svg {
|
|
203
|
+
height: 1em;
|
|
204
|
+
width: 1em;
|
|
205
|
+
font-size: 1em;
|
|
206
|
+
}
|
|
268
207
|
}
|
|
269
208
|
|
|
270
209
|
.navigation-item {
|
|
@@ -314,3 +253,7 @@
|
|
|
314
253
|
margin-top: -@spacing-1;
|
|
315
254
|
}
|
|
316
255
|
}
|
|
256
|
+
|
|
257
|
+
.navigation-link {
|
|
258
|
+
color: inherit;
|
|
259
|
+
}
|
|
@@ -7,7 +7,6 @@ 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
11
|
export const navigationItem: string;
|
|
13
12
|
export const navigationItemActive: string;
|
|
@@ -1,82 +1,20 @@
|
|
|
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.stories';
|
|
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',
|
|
12
13
|
component: HeaderNavigation,
|
|
13
14
|
parameters: {},
|
|
15
|
+
decorators: [withMemoryRouter],
|
|
14
16
|
};
|
|
15
|
-
|
|
16
|
-
const getItem = (
|
|
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
|
<HeaderNavigation
|
|
@@ -89,7 +27,6 @@ export const defaultNavigation = () => (
|
|
|
89
27
|
items.dispatch,
|
|
90
28
|
items.fleet,
|
|
91
29
|
]}
|
|
92
|
-
navigationComponent={NavLinkMock}
|
|
93
30
|
/>
|
|
94
31
|
);
|
|
95
32
|
|
|
@@ -112,7 +49,6 @@ export const withLogoTextAndOverflow = () => (
|
|
|
112
49
|
items.fleet,
|
|
113
50
|
]}
|
|
114
51
|
itemsOverflow={[items.calls, items.accounting, items.purchasing, items.dispatch]}
|
|
115
|
-
navigationComponent={NavLinkMock}
|
|
116
52
|
/>
|
|
117
53
|
);
|
|
118
54
|
|
|
@@ -130,6 +66,8 @@ const HelpCenterButton = () => {
|
|
|
130
66
|
id="help"
|
|
131
67
|
iconName="help_outline"
|
|
132
68
|
onClick={() => setOpen(true)}
|
|
69
|
+
icon={SvgIcon}
|
|
70
|
+
iconActive={SvgIcon}
|
|
133
71
|
/>
|
|
134
72
|
}
|
|
135
73
|
portal
|
|
@@ -164,11 +102,16 @@ export const withAllMonolithData = () => (
|
|
|
164
102
|
items.pointOfSale,
|
|
165
103
|
items.reports,
|
|
166
104
|
]}
|
|
167
|
-
navigationComponent={NavLinkMock}
|
|
168
105
|
>
|
|
169
106
|
<TimeZoneOffset />
|
|
170
107
|
|
|
171
|
-
<HeaderNavigationTrigger
|
|
108
|
+
<HeaderNavigationTrigger
|
|
109
|
+
id="dialpad"
|
|
110
|
+
iconName="phone"
|
|
111
|
+
counter={2}
|
|
112
|
+
icon={SvgIcon}
|
|
113
|
+
iconActive={SvgIcon}
|
|
114
|
+
/>
|
|
172
115
|
|
|
173
116
|
<HeaderNavigationLink
|
|
174
117
|
id="search"
|
|
@@ -176,6 +119,8 @@ export const withAllMonolithData = () => (
|
|
|
176
119
|
target="_blank"
|
|
177
120
|
iconComponent={SearchIcon}
|
|
178
121
|
hint="Search: for all the questions"
|
|
122
|
+
icon={SvgIcon}
|
|
123
|
+
iconActive={SvgIcon}
|
|
179
124
|
/>
|
|
180
125
|
|
|
181
126
|
<HelpCenterButton />
|
|
@@ -183,6 +128,8 @@ export const withAllMonolithData = () => (
|
|
|
183
128
|
id="titanAdvisor"
|
|
184
129
|
iconName="rocket"
|
|
185
130
|
iconClassName={Styles.rocketIcon}
|
|
131
|
+
icon={SvgIcon}
|
|
132
|
+
iconActive={SvgIcon}
|
|
186
133
|
/>
|
|
187
134
|
|
|
188
135
|
<HeaderNavigationLink
|
|
@@ -193,6 +140,8 @@ export const withAllMonolithData = () => (
|
|
|
193
140
|
aria-label="search"
|
|
194
141
|
hint="Settings"
|
|
195
142
|
isActive
|
|
143
|
+
icon={SvgIcon}
|
|
144
|
+
iconActive={SvgIcon}
|
|
196
145
|
/>
|
|
197
146
|
|
|
198
147
|
<ProfileDropdown>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Icon, Popover, PopoverPropsStrict } from '@servicetitan/design-system';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { FC, ReactElement, ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { HeaderNavigationItemData
|
|
5
|
-
import {
|
|
4
|
+
import { HeaderNavigationItemData } from '../../utils/navigation';
|
|
5
|
+
import { NavigationLegacyContext } from '../../utils/navigation-context';
|
|
6
6
|
import { HeaderNavigationItem } from './header-navigation-content';
|
|
7
7
|
import * as Styles from './header-navigation.module.less';
|
|
8
8
|
|
|
@@ -78,8 +78,6 @@ export interface HeaderNavigationProps {
|
|
|
78
78
|
items?: HeaderNavigationItemData[];
|
|
79
79
|
/** main navigation overflow items */
|
|
80
80
|
itemsOverflow?: HeaderNavigationItemData[];
|
|
81
|
-
/** navigation component used for routing */
|
|
82
|
-
navigationComponent?: FC<NavLinkComponentProps>;
|
|
83
81
|
/** props for main items overflow component */
|
|
84
82
|
overflow?: HeaderNavigationOverflowProps;
|
|
85
83
|
}
|
|
@@ -100,7 +98,6 @@ export const HeaderNavigation: FC<HeaderNavigationProps> = ({
|
|
|
100
98
|
leftClassName,
|
|
101
99
|
rightClassName,
|
|
102
100
|
minWidth = 800,
|
|
103
|
-
navigationComponent = DefaultNavLinkComponent,
|
|
104
101
|
overflow,
|
|
105
102
|
}) => {
|
|
106
103
|
const leftRef = useRef<HTMLDivElement>(null);
|
|
@@ -140,7 +137,7 @@ export const HeaderNavigation: FC<HeaderNavigationProps> = ({
|
|
|
140
137
|
});
|
|
141
138
|
|
|
142
139
|
return (
|
|
143
|
-
<
|
|
140
|
+
<NavigationLegacyContext.Provider value>
|
|
144
141
|
<div
|
|
145
142
|
className={classNames(Styles.header, className, {
|
|
146
143
|
[Styles.calculating]: minimized === MinimizedState.Calculating,
|
|
@@ -186,7 +183,7 @@ export const HeaderNavigation: FC<HeaderNavigationProps> = ({
|
|
|
186
183
|
{children}
|
|
187
184
|
</div>
|
|
188
185
|
</div>
|
|
189
|
-
</
|
|
186
|
+
</NavigationLegacyContext.Provider>
|
|
190
187
|
);
|
|
191
188
|
};
|
|
192
189
|
|
|
@@ -213,8 +210,6 @@ export interface HeaderNavigationStackedProps {
|
|
|
213
210
|
items?: HeaderNavigationItemData[];
|
|
214
211
|
/** main navigation overflow items */
|
|
215
212
|
itemsOverflow?: HeaderNavigationItemData[];
|
|
216
|
-
/** navigation component used for routing */
|
|
217
|
-
navigationComponent?: FC<NavLinkComponentProps>;
|
|
218
213
|
/** props for main items overflow component */
|
|
219
214
|
overflow?: HeaderNavigationOverflowProps;
|
|
220
215
|
}
|
|
@@ -231,7 +226,6 @@ export const HeaderNavigationStacked: FC<HeaderNavigationStackedProps> = ({
|
|
|
231
226
|
center,
|
|
232
227
|
centerClassName,
|
|
233
228
|
minWidth = 800,
|
|
234
|
-
navigationComponent = DefaultNavLinkComponent,
|
|
235
229
|
overflow,
|
|
236
230
|
}) => {
|
|
237
231
|
const bottomRef = useRef<HTMLDivElement>(null);
|
|
@@ -269,7 +263,7 @@ export const HeaderNavigationStacked: FC<HeaderNavigationStackedProps> = ({
|
|
|
269
263
|
});
|
|
270
264
|
|
|
271
265
|
return (
|
|
272
|
-
<
|
|
266
|
+
<NavigationLegacyContext.Provider value>
|
|
273
267
|
<div
|
|
274
268
|
className={classNames(
|
|
275
269
|
Styles.headerStacked,
|
|
@@ -328,76 +322,6 @@ export const HeaderNavigationStacked: FC<HeaderNavigationStackedProps> = ({
|
|
|
328
322
|
</div>
|
|
329
323
|
</div>
|
|
330
324
|
</div>
|
|
331
|
-
</
|
|
332
|
-
);
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
export interface HeaderNavigationTinyProps {
|
|
336
|
-
/** container class name */
|
|
337
|
-
className?: string;
|
|
338
|
-
/** extra navigation */
|
|
339
|
-
right?: ReactNode;
|
|
340
|
-
/** extra navigation container class name */
|
|
341
|
-
rightClassName?: string;
|
|
342
|
-
/** container id */
|
|
343
|
-
id?: string;
|
|
344
|
-
/** left content (usually used for logo) */
|
|
345
|
-
left?: ReactElement;
|
|
346
|
-
/** left container class name */
|
|
347
|
-
leftClassName?: string;
|
|
348
|
-
/** center content */
|
|
349
|
-
center?: ReactElement;
|
|
350
|
-
/** center container class name */
|
|
351
|
-
centerClassName?: string;
|
|
352
|
-
/** minimal width for navigation bar */
|
|
353
|
-
minWidth?: number;
|
|
354
|
-
/** navigation component used for routing */
|
|
355
|
-
navigationComponent?: FC<NavLinkComponentProps>;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
export const HeaderNavigationTiny: FC<HeaderNavigationTinyProps> = ({
|
|
359
|
-
className,
|
|
360
|
-
id,
|
|
361
|
-
left,
|
|
362
|
-
leftClassName,
|
|
363
|
-
right,
|
|
364
|
-
rightClassName,
|
|
365
|
-
center,
|
|
366
|
-
centerClassName,
|
|
367
|
-
minWidth = 800,
|
|
368
|
-
navigationComponent = DefaultNavLinkComponent,
|
|
369
|
-
}) => {
|
|
370
|
-
return (
|
|
371
|
-
<NavLinkContext.Provider value={navigationComponent}>
|
|
372
|
-
<div
|
|
373
|
-
className={classNames(Styles.headerTiny, className)}
|
|
374
|
-
style={{ minWidth: `${minWidth}px` }}
|
|
375
|
-
id={id}
|
|
376
|
-
data-cy="header-navigation"
|
|
377
|
-
>
|
|
378
|
-
<div
|
|
379
|
-
className={classNames(Styles.heTopLeft, leftClassName)}
|
|
380
|
-
data-cy="navigation-left"
|
|
381
|
-
>
|
|
382
|
-
{left}
|
|
383
|
-
</div>
|
|
384
|
-
<div
|
|
385
|
-
className={classNames(Styles.heTopCenter, centerClassName)}
|
|
386
|
-
data-cy="navigation-center"
|
|
387
|
-
>
|
|
388
|
-
{center}
|
|
389
|
-
</div>
|
|
390
|
-
<div
|
|
391
|
-
className={classNames(
|
|
392
|
-
'd-f flex-row justify-content-end align-items-center',
|
|
393
|
-
Styles.heTopRight,
|
|
394
|
-
rightClassName
|
|
395
|
-
)}
|
|
396
|
-
data-cy="navigation-right"
|
|
397
|
-
>
|
|
398
|
-
{right}
|
|
399
|
-
</div>
|
|
400
|
-
</div>
|
|
401
|
-
</NavLinkContext.Provider>
|
|
325
|
+
</NavigationLegacyContext.Provider>
|
|
402
326
|
);
|
|
403
327
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { withAnvil, withMemoryRouter } from '../test/data.stories';
|
|
1
2
|
import {
|
|
2
3
|
WithAllMonolithData,
|
|
3
4
|
WithAllMonolithDataCommercial,
|
|
4
|
-
} from './
|
|
5
|
-
import { DefaultSideNavigation } from './
|
|
5
|
+
} from './left-navigation/header-navigation-tiny.stories';
|
|
6
|
+
import { DefaultSideNavigation } from './left-navigation/side-navigation.stories';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: 'Navigation/Layout',
|
|
9
10
|
parameters: {},
|
|
11
|
+
decorators: [withMemoryRouter, withAnvil],
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export const LeftNavLayout = () => {
|