@servicetitan/navigation 1.6.0 → 2.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 +30 -0
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +1 -0
- package/dist/components/header-navigation/header-navigation-content.js +21 -0
- package/dist/components/header-navigation/header-navigation-content.js.map +1 -0
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +2 -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 +7 -7
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +38 -0
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -0
- package/dist/components/header-navigation/header-navigation-links.js +38 -0
- package/dist/components/header-navigation/header-navigation-links.js.map +1 -0
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts +11 -0
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +1 -0
- package/dist/components/header-navigation/header-navigation-stacked.stories.js +66 -0
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -0
- package/dist/components/header-navigation/header-navigation.d.ts +43 -36
- package/dist/components/header-navigation/header-navigation.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.js +41 -81
- package/dist/components/header-navigation/header-navigation.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.module.less +172 -95
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js +8 -8
- package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
- package/dist/components/header-navigation/index.d.ts +3 -0
- package/dist/components/header-navigation/index.d.ts.map +1 -0
- package/dist/components/header-navigation/index.js +3 -0
- package/dist/components/header-navigation/index.js.map +1 -0
- package/dist/components/logo/logo-titan-text.d.ts +21 -5
- package/dist/components/logo/logo-titan-text.d.ts.map +1 -1
- package/dist/components/logo/logo-titan-text.js +9 -3
- package/dist/components/logo/logo-titan-text.js.map +1 -1
- package/dist/components/logo/logo-titan-text.module.less +12 -9
- package/dist/components/logo/logo-titan.d.ts +2 -2
- package/dist/components/logo/logo-titan.d.ts.map +1 -1
- 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 +2 -1
- package/dist/components/logo/logo.stories.d.ts.map +1 -1
- package/dist/components/logo/logo.stories.js +7 -5
- package/dist/components/logo/logo.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +15 -0
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js +51 -0
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +1 -0
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +3 -3
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +0 -2
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-icon.d.ts +1 -1
- package/dist/components/profile-dropdown/profile-icon.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-icon.js +1 -1
- package/dist/components/profile-dropdown/profile-icon.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/utils/with-tooltip.d.ts +3 -0
- package/dist/utils/with-tooltip.d.ts.map +1 -0
- package/dist/utils/with-tooltip.js +4 -0
- package/dist/utils/with-tooltip.js.map +1 -0
- package/package.json +2 -2
- package/src/components/header-navigation/header-navigation-content.tsx +118 -0
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +23 -17
- package/src/components/header-navigation/header-navigation-links.tsx +143 -0
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +172 -0
- package/src/components/header-navigation/header-navigation.module.less +172 -95
- package/src/components/header-navigation/header-navigation.module.less.d.ts +14 -9
- package/src/components/header-navigation/header-navigation.stories.tsx +11 -19
- package/src/components/header-navigation/header-navigation.tsx +163 -283
- package/src/components/header-navigation/index.ts +2 -0
- package/src/components/logo/logo-titan-text.module.less +12 -9
- package/src/components/logo/logo-titan-text.tsx +62 -20
- package/src/components/logo/logo-titan.tsx +2 -2
- package/src/components/logo/logo.stories.tsx +13 -4
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +178 -0
- package/src/components/profile-dropdown/profile-dropdown.module.less +0 -2
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +1 -1
- package/src/components/profile-dropdown/profile-dropdown.tsx +5 -3
- package/src/components/profile-dropdown/profile-icon.tsx +2 -1
- package/src/index.ts +2 -1
- package/src/utils/with-tooltip.tsx +11 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Icon, IconPropsStrict } from '@servicetitan/design-system';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { FC, Fragment } from 'react';
|
|
4
|
+
import { HeaderNavigationItemData } from '../../utils/navigation';
|
|
5
|
+
import { useNavLink } from '../../utils/navigation-context';
|
|
6
|
+
import { withTooltip } from '../../utils/with-tooltip';
|
|
7
|
+
import { CounterTag, CounterTagPropsType } from '../counter-tag';
|
|
8
|
+
import * as Styles from './header-navigation.module.less';
|
|
9
|
+
|
|
10
|
+
export interface HeaderNavigationItemContentPropsStrict {
|
|
11
|
+
/** item text */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** text component class name */
|
|
14
|
+
titleClassName?: string;
|
|
15
|
+
/** counter shown for item */
|
|
16
|
+
counter?: CounterTagPropsType;
|
|
17
|
+
/** counter component class name */
|
|
18
|
+
counterClassName?: string;
|
|
19
|
+
/** icon component class name */
|
|
20
|
+
iconClassName?: string;
|
|
21
|
+
/** IconComponent custom icon component */
|
|
22
|
+
iconComponent?: FC;
|
|
23
|
+
/** iconName name of anvil icon */
|
|
24
|
+
iconName?: IconPropsStrict['name'];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Content for navigation items */
|
|
28
|
+
export const HeaderNavigationItemContent: FC<HeaderNavigationItemContentPropsStrict> = ({
|
|
29
|
+
title,
|
|
30
|
+
titleClassName,
|
|
31
|
+
counter,
|
|
32
|
+
counterClassName,
|
|
33
|
+
iconClassName,
|
|
34
|
+
iconComponent: IconComponent,
|
|
35
|
+
iconName,
|
|
36
|
+
}) => {
|
|
37
|
+
const iconClass = classNames(Styles.navigationIcon, iconClassName);
|
|
38
|
+
return (
|
|
39
|
+
<Fragment>
|
|
40
|
+
{IconComponent ? (
|
|
41
|
+
<i className={iconClass}>
|
|
42
|
+
<IconComponent />
|
|
43
|
+
</i>
|
|
44
|
+
) : iconName ? (
|
|
45
|
+
<Icon name={iconName} className={iconClass} />
|
|
46
|
+
) : (
|
|
47
|
+
<i className={iconClass} />
|
|
48
|
+
)}
|
|
49
|
+
|
|
50
|
+
{!!title && (
|
|
51
|
+
<span className={classNames(Styles.navigationItemTitle, titleClassName)}>
|
|
52
|
+
{title}
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
|
|
56
|
+
{!!counter && (
|
|
57
|
+
<CounterTag
|
|
58
|
+
data={counter}
|
|
59
|
+
className={classNames(Styles.navigationItemCounter, counterClassName)}
|
|
60
|
+
longClassName={Styles.navigationItemCounterLong}
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
63
|
+
</Fragment>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
interface HeaderNavigationItemPropsStrict extends HeaderNavigationItemData {
|
|
68
|
+
minimized: boolean;
|
|
69
|
+
main: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Navigation main menu item */
|
|
73
|
+
export const HeaderNavigationItem: FC<HeaderNavigationItemPropsStrict> = ({
|
|
74
|
+
id,
|
|
75
|
+
to,
|
|
76
|
+
title,
|
|
77
|
+
hint,
|
|
78
|
+
counter,
|
|
79
|
+
className,
|
|
80
|
+
iconClassName,
|
|
81
|
+
iconComponent,
|
|
82
|
+
iconName,
|
|
83
|
+
isActive,
|
|
84
|
+
main,
|
|
85
|
+
minimized,
|
|
86
|
+
}) => {
|
|
87
|
+
const NavigationComponent = useNavLink();
|
|
88
|
+
|
|
89
|
+
return withTooltip(
|
|
90
|
+
<NavigationComponent
|
|
91
|
+
data-cy={`navigation-item-${id}`}
|
|
92
|
+
data-pendo={`navigation-item-${id}`}
|
|
93
|
+
key={id}
|
|
94
|
+
to={to}
|
|
95
|
+
title={hint}
|
|
96
|
+
className={classNames(
|
|
97
|
+
Styles.navigationItem,
|
|
98
|
+
main ? Styles.navigationItemMain : Styles.navigationItemOverflow,
|
|
99
|
+
className,
|
|
100
|
+
{
|
|
101
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
102
|
+
}
|
|
103
|
+
)}
|
|
104
|
+
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
105
|
+
activeClassName={Styles.navigationItemActive}
|
|
106
|
+
>
|
|
107
|
+
<HeaderNavigationItemContent
|
|
108
|
+
title={minimized ? undefined : title}
|
|
109
|
+
titleClassName={main ? '' : 'm-l-half'}
|
|
110
|
+
counter={counter}
|
|
111
|
+
iconComponent={iconComponent}
|
|
112
|
+
iconClassName={iconClassName}
|
|
113
|
+
iconName={iconName}
|
|
114
|
+
/>
|
|
115
|
+
</NavigationComponent>,
|
|
116
|
+
minimized ? title : undefined
|
|
117
|
+
);
|
|
118
|
+
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Popover } from '@servicetitan/design-system';
|
|
1
|
+
import { Button, Popover } from '@servicetitan/design-system';
|
|
2
2
|
import { FC, useState } from 'react';
|
|
3
3
|
import { NavLinkComponentProps } from '../../utils/navigation';
|
|
4
4
|
import {
|
|
5
5
|
HeaderNavigation,
|
|
6
|
-
HeaderNavigationItemContent,
|
|
7
6
|
HeaderNavigationLink,
|
|
8
7
|
HeaderNavigationTrigger,
|
|
9
8
|
HeaderNavigationTriggerCustom,
|
|
10
|
-
} from './
|
|
9
|
+
} from './';
|
|
11
10
|
|
|
12
11
|
export default {
|
|
13
12
|
title: 'Navigation/HeaderNavigationExtra',
|
|
@@ -15,7 +14,13 @@ export default {
|
|
|
15
14
|
parameters: {},
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
const NavLinkMock: FC<NavLinkComponentProps> = ({
|
|
17
|
+
const NavLinkMock: FC<NavLinkComponentProps> = ({
|
|
18
|
+
to,
|
|
19
|
+
children,
|
|
20
|
+
isActive,
|
|
21
|
+
activeClassName,
|
|
22
|
+
...rest
|
|
23
|
+
}) => (
|
|
19
24
|
<a
|
|
20
25
|
{...rest}
|
|
21
26
|
href={to}
|
|
@@ -28,7 +33,7 @@ const NavLinkMock: FC<NavLinkComponentProps> = ({ to, children, ...rest }) => (
|
|
|
28
33
|
);
|
|
29
34
|
|
|
30
35
|
export const extraLink = () => (
|
|
31
|
-
<HeaderNavigation items={[]} navigationComponent={NavLinkMock}
|
|
36
|
+
<HeaderNavigation items={[]} navigationComponent={NavLinkMock} rightClassName="m-r-1">
|
|
32
37
|
<HeaderNavigationLink
|
|
33
38
|
id="search"
|
|
34
39
|
to="https://google.com"
|
|
@@ -40,8 +45,8 @@ export const extraLink = () => (
|
|
|
40
45
|
);
|
|
41
46
|
|
|
42
47
|
export const extraTrigger = () => (
|
|
43
|
-
<HeaderNavigation items={[]} navigationComponent={NavLinkMock}
|
|
44
|
-
<HeaderNavigationTrigger id="dialpad" iconName="phone" counter={2} />
|
|
48
|
+
<HeaderNavigation items={[]} navigationComponent={NavLinkMock} rightClassName="m-r-1">
|
|
49
|
+
<HeaderNavigationTrigger id="dialpad" iconName="phone" counter={2} tooltip="Phones pro" />
|
|
45
50
|
</HeaderNavigation>
|
|
46
51
|
);
|
|
47
52
|
|
|
@@ -53,22 +58,20 @@ export const extraCustomTrigger = () => (
|
|
|
53
58
|
</HeaderNavigation>
|
|
54
59
|
);
|
|
55
60
|
|
|
56
|
-
export const
|
|
57
|
-
<HeaderNavigation items={[]} navigationComponent={NavLinkMock}
|
|
61
|
+
export const extraWithTooltip = () => (
|
|
62
|
+
<HeaderNavigation items={[]} navigationComponent={NavLinkMock} rightClassName="m-r-1">
|
|
58
63
|
<HeaderNavigationLink
|
|
59
64
|
id="search"
|
|
60
65
|
to="https://google.com"
|
|
61
66
|
target="_blank"
|
|
62
67
|
iconName="search"
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
tooltip="Search: for all the questions"
|
|
69
|
+
hint="Google"
|
|
65
70
|
/>
|
|
66
71
|
|
|
67
72
|
<HeaderNavigationTrigger id="dialpad" iconName="phone" title="Dialpad" counter={2} />
|
|
68
73
|
|
|
69
|
-
<
|
|
70
|
-
<HelpCenterButton />
|
|
71
|
-
</HeaderNavigationTriggerCustom>
|
|
74
|
+
<HelpCenterButton />
|
|
72
75
|
</HeaderNavigation>
|
|
73
76
|
);
|
|
74
77
|
|
|
@@ -82,9 +85,12 @@ const HelpCenterButton = () => {
|
|
|
82
85
|
direction="bl"
|
|
83
86
|
width="xs"
|
|
84
87
|
trigger={
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
<Button
|
|
89
|
+
className="c-white"
|
|
90
|
+
iconName="help_outline"
|
|
91
|
+
fill="subtle"
|
|
92
|
+
onClick={() => setOpen(true)}
|
|
93
|
+
/>
|
|
88
94
|
}
|
|
89
95
|
portal
|
|
90
96
|
>
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { FC, HTMLAttributeAnchorTarget, ReactNode } from 'react';
|
|
3
|
+
import { useNavLink } from '../../utils/navigation-context';
|
|
4
|
+
import { withTooltip } from '../../utils/with-tooltip';
|
|
5
|
+
import {
|
|
6
|
+
HeaderNavigationItemContent,
|
|
7
|
+
HeaderNavigationItemContentPropsStrict,
|
|
8
|
+
} from './header-navigation-content';
|
|
9
|
+
import * as Styles from './header-navigation.module.less';
|
|
10
|
+
|
|
11
|
+
export interface HeaderNavigationTriggerPropsStrict
|
|
12
|
+
extends Omit<HeaderNavigationItemContentPropsStrict, 'title' | 'size'> {
|
|
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
|
+
}
|
|
22
|
+
|
|
23
|
+
interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStrict {
|
|
24
|
+
/** unstrict props */
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface HeaderNavigationLinkPropsStrict extends HeaderNavigationTriggerPropsStrict {
|
|
29
|
+
/** link href */
|
|
30
|
+
to: string;
|
|
31
|
+
/** isActive */
|
|
32
|
+
isActive?: boolean | ((pathname: string) => boolean);
|
|
33
|
+
/** link html target */
|
|
34
|
+
target?: HTMLAttributeAnchorTarget;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface HeaderNavigationLinkProps extends HeaderNavigationLinkPropsStrict {
|
|
38
|
+
/** unstrict props */
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Navigation extra item with link */
|
|
43
|
+
export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
44
|
+
id,
|
|
45
|
+
to,
|
|
46
|
+
hint,
|
|
47
|
+
tooltip,
|
|
48
|
+
counter,
|
|
49
|
+
className,
|
|
50
|
+
iconClassName,
|
|
51
|
+
iconComponent,
|
|
52
|
+
iconName,
|
|
53
|
+
isActive,
|
|
54
|
+
target,
|
|
55
|
+
...rest
|
|
56
|
+
}) => {
|
|
57
|
+
const NavigationComponent = useNavLink();
|
|
58
|
+
|
|
59
|
+
return withTooltip(
|
|
60
|
+
<NavigationComponent
|
|
61
|
+
data-cy={`navigation-link-${id}`}
|
|
62
|
+
data-pendo={`navigation-link-${id}`}
|
|
63
|
+
{...rest}
|
|
64
|
+
key={id}
|
|
65
|
+
to={to}
|
|
66
|
+
title={hint}
|
|
67
|
+
className={classNames(Styles.navigationLink, Styles.navigationItem, className, {
|
|
68
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
69
|
+
})}
|
|
70
|
+
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
71
|
+
activeClassName={Styles.navigationItemActive}
|
|
72
|
+
target={target}
|
|
73
|
+
>
|
|
74
|
+
<HeaderNavigationItemContent
|
|
75
|
+
counter={counter}
|
|
76
|
+
iconComponent={iconComponent}
|
|
77
|
+
iconClassName={iconClassName}
|
|
78
|
+
iconName={iconName}
|
|
79
|
+
/>
|
|
80
|
+
</NavigationComponent>,
|
|
81
|
+
tooltip
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/** Navigation extra item with icon button */
|
|
86
|
+
export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
87
|
+
id,
|
|
88
|
+
className,
|
|
89
|
+
counter,
|
|
90
|
+
iconClassName,
|
|
91
|
+
iconComponent,
|
|
92
|
+
iconName,
|
|
93
|
+
hint,
|
|
94
|
+
tooltip,
|
|
95
|
+
...rest
|
|
96
|
+
}) =>
|
|
97
|
+
withTooltip(
|
|
98
|
+
<div
|
|
99
|
+
data-cy={`navigation-trigger-${id}`}
|
|
100
|
+
data-pendo={`navigation-trigger-${id}`}
|
|
101
|
+
{...rest}
|
|
102
|
+
title={hint}
|
|
103
|
+
className={classNames(
|
|
104
|
+
Styles.navigationItem,
|
|
105
|
+
Styles.navigationLink,
|
|
106
|
+
'cursor-pointer',
|
|
107
|
+
className
|
|
108
|
+
)}
|
|
109
|
+
>
|
|
110
|
+
<HeaderNavigationItemContent
|
|
111
|
+
counter={counter}
|
|
112
|
+
iconComponent={iconComponent}
|
|
113
|
+
iconClassName={iconClassName}
|
|
114
|
+
iconName={iconName}
|
|
115
|
+
/>
|
|
116
|
+
</div>,
|
|
117
|
+
tooltip
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
/** Navigation extra item with custom content */
|
|
121
|
+
export const HeaderNavigationTriggerCustom: FC<
|
|
122
|
+
Omit<
|
|
123
|
+
HeaderNavigationTriggerProps,
|
|
124
|
+
'counter' | 'iconSize' | 'iconName' | 'iconComponent' | 'iconClassName'
|
|
125
|
+
> & { children: ReactNode }
|
|
126
|
+
> = ({ children, id, className, tooltip, title, ...rest }) =>
|
|
127
|
+
withTooltip(
|
|
128
|
+
<div
|
|
129
|
+
data-cy={`navigation-custom-${id}`}
|
|
130
|
+
data-pendo={`navigation-custom-${id}`}
|
|
131
|
+
{...rest}
|
|
132
|
+
title={title}
|
|
133
|
+
className={classNames(
|
|
134
|
+
Styles.navigationItem,
|
|
135
|
+
Styles.navigationLink,
|
|
136
|
+
'cursor-pointer',
|
|
137
|
+
className
|
|
138
|
+
)}
|
|
139
|
+
>
|
|
140
|
+
{children}
|
|
141
|
+
</div>,
|
|
142
|
+
tooltip
|
|
143
|
+
);
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Input, Stack } from '@servicetitan/design-system';
|
|
2
|
+
import { FC, Fragment } from 'react';
|
|
3
|
+
import { HeaderNavigationItemData, NavLinkComponentProps } from '../../utils/navigation';
|
|
4
|
+
import { LogoCompanyTitle } from '../logo/logo-company-title';
|
|
5
|
+
import { LogoTitan, LogoTitanTitle } from '../logo/logo-titan-text';
|
|
6
|
+
import { ProfileDropdown } from '../profile-dropdown/profile-dropdown';
|
|
7
|
+
import { HeaderNavigationLink, HeaderNavigationStacked, HeaderNavigationTrigger } from './';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Navigation/HeaderNavigationStacked',
|
|
11
|
+
component: HeaderNavigationStacked,
|
|
12
|
+
parameters: {},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getItem = (
|
|
16
|
+
id: string,
|
|
17
|
+
data: Partial<HeaderNavigationItemData>
|
|
18
|
+
): HeaderNavigationItemData => ({
|
|
19
|
+
id,
|
|
20
|
+
to: '/',
|
|
21
|
+
title: id[0].toUpperCase() + id.substring(1),
|
|
22
|
+
hint: id,
|
|
23
|
+
...(data ?? {}),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const InventoryIcon = () => (
|
|
27
|
+
<svg width="20" xmlns="http://www.w3.org/2000/svg" viewBox="-293 385 24 24" fill="currentColor">
|
|
28
|
+
<polyline points="-288,400.9 -282,404.3 -282,397.6 -288,394.2 -288,400.9 " />
|
|
29
|
+
<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" />
|
|
30
|
+
</svg>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const items = {
|
|
34
|
+
calendar: getItem('calendar', { iconName: 'event' }),
|
|
35
|
+
calls: getItem('calls', { iconName: 'local_phone', isActive: true, counter: 12 }),
|
|
36
|
+
dashboard: getItem('dashboard', { iconName: 'odometer', isActive: true }),
|
|
37
|
+
dispatch: getItem('dispatch', { iconName: 'location_disabled', counter: 1 }),
|
|
38
|
+
fleet: getItem('fleet', { iconName: 'fleet-pro', title: 'Fleet Pro' }),
|
|
39
|
+
followUps: getItem('followUps', { iconName: 'flag', title: 'Follow Ups' }),
|
|
40
|
+
inventory: getItem('inventory', { iconName: 'toys' }),
|
|
41
|
+
purchasing: getItem('purchasing', { iconComponent: InventoryIcon }),
|
|
42
|
+
accounting: getItem('accounting', { iconName: 'assignment' }),
|
|
43
|
+
marketing: getItem('marketing', { iconName: 'bullhorn' }),
|
|
44
|
+
priceBook: getItem('priceBook', { iconName: 'book' }),
|
|
45
|
+
pointOfSale: getItem('pointOfSale', { iconName: 'cash-register' }),
|
|
46
|
+
projects: getItem('projects', { iconName: 'folder_special' }),
|
|
47
|
+
reports: getItem('reports', { iconName: 'poll' }),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const NavLinkMock: FC<NavLinkComponentProps> = props => (
|
|
51
|
+
<a
|
|
52
|
+
href={props.to}
|
|
53
|
+
target={props.target}
|
|
54
|
+
onClick={e => {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
}}
|
|
57
|
+
className={props.className}
|
|
58
|
+
>
|
|
59
|
+
{props.children}
|
|
60
|
+
</a>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
export const defaultNavigation = () => (
|
|
64
|
+
<HeaderNavigationStacked
|
|
65
|
+
left={<LogoCompanyTitle className="m-l-1" fill="#fff" />}
|
|
66
|
+
leftClassName="d-f align-items-center"
|
|
67
|
+
items={[
|
|
68
|
+
items.dashboard,
|
|
69
|
+
items.calendar,
|
|
70
|
+
items.calls,
|
|
71
|
+
items.accounting,
|
|
72
|
+
items.dispatch,
|
|
73
|
+
items.fleet,
|
|
74
|
+
]}
|
|
75
|
+
navigationComponent={NavLinkMock}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
export const withLogoTextAndOverflow = () => (
|
|
80
|
+
<HeaderNavigationStacked
|
|
81
|
+
left={
|
|
82
|
+
<Stack alignItems="center">
|
|
83
|
+
<LogoTitan mantleFill="#2270EE" size={44} />
|
|
84
|
+
<LogoTitanTitle className="c-white m-l-1">Commercial</LogoTitanTitle>
|
|
85
|
+
</Stack>
|
|
86
|
+
}
|
|
87
|
+
items={[
|
|
88
|
+
items.dashboard,
|
|
89
|
+
items.calendar,
|
|
90
|
+
items.calls,
|
|
91
|
+
items.accounting,
|
|
92
|
+
items.dispatch,
|
|
93
|
+
items.purchasing,
|
|
94
|
+
items.fleet,
|
|
95
|
+
]}
|
|
96
|
+
itemsOverflow={[items.calls, items.accounting, items.purchasing, items.dispatch]}
|
|
97
|
+
navigationComponent={NavLinkMock}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const TimeZoneOffset: FC = () => (
|
|
102
|
+
<div className="fs-2 fw-bold p-x-1">
|
|
103
|
+
<span>EST (-9 hrs)</span>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
export const withAllMonolithData = () => (
|
|
108
|
+
<HeaderNavigationStacked
|
|
109
|
+
left={<LogoCompanyTitle className="m-l-1" fill="#fff" />}
|
|
110
|
+
leftClassName="d-f align-items-center"
|
|
111
|
+
items={[
|
|
112
|
+
items.dashboard,
|
|
113
|
+
items.calendar,
|
|
114
|
+
items.calls,
|
|
115
|
+
items.accounting,
|
|
116
|
+
items.dispatch,
|
|
117
|
+
|
|
118
|
+
items.fleet,
|
|
119
|
+
items.followUps,
|
|
120
|
+
items.inventory,
|
|
121
|
+
|
|
122
|
+
items.marketing,
|
|
123
|
+
items.priceBook,
|
|
124
|
+
items.pointOfSale,
|
|
125
|
+
items.reports,
|
|
126
|
+
]}
|
|
127
|
+
navigationComponent={NavLinkMock}
|
|
128
|
+
right={
|
|
129
|
+
<Fragment>
|
|
130
|
+
<TimeZoneOffset />
|
|
131
|
+
|
|
132
|
+
<HeaderNavigationTrigger id="dialpad" iconName="phone" counter={2} />
|
|
133
|
+
|
|
134
|
+
<HeaderNavigationLink
|
|
135
|
+
id="search"
|
|
136
|
+
to="https://google.com"
|
|
137
|
+
target="_blank"
|
|
138
|
+
iconName="search"
|
|
139
|
+
hint="Search: for all the questions"
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<HeaderNavigationTrigger id="titanAdvisor" iconName="rocket" />
|
|
143
|
+
|
|
144
|
+
<HeaderNavigationLink
|
|
145
|
+
id="settings"
|
|
146
|
+
to="https://google.com"
|
|
147
|
+
target="_blank"
|
|
148
|
+
iconName="settings"
|
|
149
|
+
aria-label="search"
|
|
150
|
+
hint="Settings"
|
|
151
|
+
isActive
|
|
152
|
+
/>
|
|
153
|
+
|
|
154
|
+
<ProfileDropdown>
|
|
155
|
+
<ProfileDropdown.Link id="tasks" to="https://googgle.com" counter={10}>
|
|
156
|
+
Task Management
|
|
157
|
+
</ProfileDropdown.Link>
|
|
158
|
+
<ProfileDropdown.Divider />
|
|
159
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
160
|
+
Sign Out{' '}
|
|
161
|
+
<span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
162
|
+
</ProfileDropdown.Link>
|
|
163
|
+
<ProfileDropdown.Section id="userid" className="c-neutral-100 fs-1">
|
|
164
|
+
User ID: 007
|
|
165
|
+
</ProfileDropdown.Section>
|
|
166
|
+
</ProfileDropdown>
|
|
167
|
+
</Fragment>
|
|
168
|
+
}
|
|
169
|
+
center={<Input placeholder="Search smth" size="xsmall" className="w-100" />}
|
|
170
|
+
centerClassName="d-f align-items-center"
|
|
171
|
+
/>
|
|
172
|
+
);
|