@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
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Icon, IconProps } from '@servicetitan/anvil2';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { FC, Fragment, useContext } from 'react';
|
|
4
|
+
import { HeaderNavigationLinkProps, HeaderNavigationTriggerProps } from '../../utils/navigation';
|
|
5
|
+
import { NavigationComponentContext } 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-tiny.module.less';
|
|
9
|
+
|
|
10
|
+
/** Content for navigation items */
|
|
11
|
+
export const HeaderNavigationItemContent: FC<{
|
|
12
|
+
counter?: CounterTagPropsType;
|
|
13
|
+
counterClassName?: string;
|
|
14
|
+
icon: IconProps['svg'] | undefined;
|
|
15
|
+
iconActive: IconProps['svg'] | undefined;
|
|
16
|
+
}> = ({ counter, counterClassName, icon, iconActive }) => {
|
|
17
|
+
return (
|
|
18
|
+
<Fragment>
|
|
19
|
+
{!!icon && <Icon svg={icon} className={Styles.navigationIcon} />}
|
|
20
|
+
{!!iconActive && (
|
|
21
|
+
<Icon
|
|
22
|
+
svg={iconActive}
|
|
23
|
+
className={classNames(Styles.navigationIcon, Styles.navigationIconActive)}
|
|
24
|
+
/>
|
|
25
|
+
)}
|
|
26
|
+
|
|
27
|
+
{!!counter && (
|
|
28
|
+
<CounterTag
|
|
29
|
+
data={counter}
|
|
30
|
+
className={classNames(Styles.navigationItemCounter, counterClassName)}
|
|
31
|
+
longClassName={Styles.navigationItemCounterLong}
|
|
32
|
+
/>
|
|
33
|
+
)}
|
|
34
|
+
</Fragment>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Navigation extra item with link */
|
|
39
|
+
export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
40
|
+
id,
|
|
41
|
+
to,
|
|
42
|
+
hint,
|
|
43
|
+
tooltip,
|
|
44
|
+
counter,
|
|
45
|
+
className,
|
|
46
|
+
icon,
|
|
47
|
+
iconActive,
|
|
48
|
+
isActive,
|
|
49
|
+
target,
|
|
50
|
+
...rest
|
|
51
|
+
}) => {
|
|
52
|
+
const NavigationComponent = useContext(NavigationComponentContext);
|
|
53
|
+
|
|
54
|
+
return withTooltip(
|
|
55
|
+
<NavigationComponent
|
|
56
|
+
data-cy={`navigation-link-${id}`}
|
|
57
|
+
data-pendo={`navigation-link-${id}`}
|
|
58
|
+
{...rest}
|
|
59
|
+
key={id}
|
|
60
|
+
to={to}
|
|
61
|
+
title={hint}
|
|
62
|
+
className={classNames(Styles.navigationLink, className, {
|
|
63
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
64
|
+
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
65
|
+
})}
|
|
66
|
+
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
67
|
+
activeClassName={Styles.navigationItemActive}
|
|
68
|
+
target={target}
|
|
69
|
+
>
|
|
70
|
+
<HeaderNavigationItemContent counter={counter} icon={icon} iconActive={iconActive} />
|
|
71
|
+
</NavigationComponent>,
|
|
72
|
+
tooltip
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** Navigation extra item with icon button */
|
|
77
|
+
export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
78
|
+
id,
|
|
79
|
+
className,
|
|
80
|
+
counter,
|
|
81
|
+
icon,
|
|
82
|
+
iconActive,
|
|
83
|
+
isActive,
|
|
84
|
+
hint,
|
|
85
|
+
tooltip,
|
|
86
|
+
title,
|
|
87
|
+
titleClassName,
|
|
88
|
+
...rest
|
|
89
|
+
}) => {
|
|
90
|
+
return withTooltip(
|
|
91
|
+
<div
|
|
92
|
+
data-cy={`navigation-trigger-${id}`}
|
|
93
|
+
data-pendo={`navigation-trigger-${id}`}
|
|
94
|
+
{...rest}
|
|
95
|
+
title={hint}
|
|
96
|
+
className={classNames(
|
|
97
|
+
Styles.navigationLink,
|
|
98
|
+
{
|
|
99
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
100
|
+
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
101
|
+
},
|
|
102
|
+
'cursor-pointer',
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
>
|
|
106
|
+
<HeaderNavigationItemContent counter={counter} icon={icon} iconActive={iconActive} />
|
|
107
|
+
</div>,
|
|
108
|
+
tooltip
|
|
109
|
+
);
|
|
110
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/* stylelint-disable no-descending-specificity */
|
|
2
|
+
@import (reference) '@servicetitan/tokens/core/tokens.less';
|
|
3
|
+
|
|
4
|
+
@size-links-tiny: 24px;
|
|
5
|
+
|
|
6
|
+
.header-tiny {
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: repeat(3, 1fr);
|
|
9
|
+
grid-template-rows: 48px;
|
|
10
|
+
|
|
11
|
+
background-color: @color-white;
|
|
12
|
+
color: @color-black;
|
|
13
|
+
|
|
14
|
+
& > * {
|
|
15
|
+
overflow-y: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.he-top-left {
|
|
19
|
+
grid-column: span 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.he-top-center {
|
|
23
|
+
grid-column: span 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.he-top-right {
|
|
27
|
+
grid-column: span 1;
|
|
28
|
+
|
|
29
|
+
& > * {
|
|
30
|
+
color: @color-black;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:global(.profile-dropdown-image) {
|
|
35
|
+
height: 24px;
|
|
36
|
+
width: 24px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:global(.profile-dropdown-trigger) {
|
|
40
|
+
height: 32px;
|
|
41
|
+
font-size: @size-links-tiny;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.navigation-link {
|
|
45
|
+
margin: 6px 2px;
|
|
46
|
+
padding: 6px 6px;
|
|
47
|
+
border-radius: 12px;
|
|
48
|
+
font-size: @size-links-tiny;
|
|
49
|
+
color: inherit;
|
|
50
|
+
|
|
51
|
+
&.navigation-item-active:not(.navigation-item-overflow) {
|
|
52
|
+
background-color: @color-blue-100 !important;
|
|
53
|
+
color: @color-blue-500 !important;
|
|
54
|
+
}
|
|
55
|
+
&:hover:not(.navigation-item-active):not(.navigation-item-overflow) {
|
|
56
|
+
background-color: rgba(0, 0, 0, 0.12) !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.navigation-item-icon-state.navigation-item-active {
|
|
60
|
+
.navigation-icon:not(.navigation-icon-active) {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.navigation-icon.navigation-icon-active[data-anv][data-anv] {
|
|
65
|
+
display: block;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.navigation-icon[data-anv][data-anv] {
|
|
71
|
+
display: inline-block;
|
|
72
|
+
color: inherit;
|
|
73
|
+
height: 24px;
|
|
74
|
+
width: 24px;
|
|
75
|
+
|
|
76
|
+
> svg {
|
|
77
|
+
height: @size-links-tiny;
|
|
78
|
+
width: @size-links-tiny;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.navigation-icon-active {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.navigation-link {
|
|
88
|
+
// styles specific to extra nav links
|
|
89
|
+
color: @color-black;
|
|
90
|
+
position: relative;
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
flex-wrap: nowrap;
|
|
94
|
+
text-wrap: nowrap;
|
|
95
|
+
|
|
96
|
+
.navigation-item-counter {
|
|
97
|
+
color: @color-white;
|
|
98
|
+
font-weight: @font-weight-semibold;
|
|
99
|
+
font-size: 8px !important;
|
|
100
|
+
min-width: 12px;
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: 4px;
|
|
103
|
+
right: -2px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&.navigation-item-counter-long {
|
|
107
|
+
right: -8px;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const __esModule: true;
|
|
2
|
+
export const heTopCenter: string;
|
|
3
|
+
export const heTopLeft: string;
|
|
4
|
+
export const heTopRight: string;
|
|
5
|
+
export const headerTiny: string;
|
|
6
|
+
export const navigationIcon: string;
|
|
7
|
+
export const navigationIconActive: string;
|
|
8
|
+
export const navigationItemActive: string;
|
|
9
|
+
export const navigationItemCounter: string;
|
|
10
|
+
export const navigationItemCounterLong: string;
|
|
11
|
+
export const navigationItemIconState: string;
|
|
12
|
+
export const navigationItemOverflow: string;
|
|
13
|
+
export const navigationLink: string;
|
|
14
|
+
|
package/src/components/{header-navigation → left-navigation}/header-navigation-tiny.stories.tsx
RENAMED
|
@@ -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
|
+
SearchIcon,
|
|
12
|
+
withAnvil,
|
|
13
|
+
withMemoryRouter,
|
|
14
|
+
} from '../../test/data.stories';
|
|
15
|
+
import * as Styles from '../header-navigation/header-navigation-stories.module.less';
|
|
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
|
-
import
|
|
8
|
-
import { HeaderNavigationLink
|
|
19
|
+
import { HeaderNavigationTiny } from './header-navigation-tiny';
|
|
20
|
+
import { HeaderNavigationLink } from './header-navigation-tiny-links';
|
|
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,42 +34,11 @@ export default {
|
|
|
20
34
|
],
|
|
21
35
|
};
|
|
22
36
|
|
|
23
|
-
const
|
|
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
|
-
export const defaultNavigation = () => (
|
|
37
|
+
export const DefaultTinyNavigation = () => (
|
|
54
38
|
<HeaderNavigationTiny
|
|
55
39
|
className="border-bottom"
|
|
56
40
|
left={<LogoCompanyTitle className="m-l-1" size="150" />}
|
|
57
41
|
leftClassName="d-f align-items-center"
|
|
58
|
-
navigationComponent={NavLinkMock}
|
|
59
42
|
/>
|
|
60
43
|
);
|
|
61
44
|
|
|
@@ -70,7 +53,6 @@ export const WithAllMonolithData = () => (
|
|
|
70
53
|
className="border-bottom"
|
|
71
54
|
left={<LogoCompanyTitle className="m-l-1" size="150" />}
|
|
72
55
|
leftClassName="d-f align-items-center"
|
|
73
|
-
navigationComponent={NavLinkMock}
|
|
74
56
|
right={
|
|
75
57
|
<Fragment>
|
|
76
58
|
<TimeZoneOffset />
|
|
@@ -81,24 +63,31 @@ export const WithAllMonolithData = () => (
|
|
|
81
63
|
target="_blank"
|
|
82
64
|
iconComponent={SearchIcon}
|
|
83
65
|
hint="Search: for all the questions"
|
|
66
|
+
tooltip="Search"
|
|
67
|
+
icon={SvgSearch}
|
|
68
|
+
iconActive={SvgSearch}
|
|
84
69
|
/>
|
|
85
70
|
|
|
86
|
-
<
|
|
71
|
+
<CallsNavigationTrigger />
|
|
87
72
|
|
|
88
|
-
<
|
|
73
|
+
<HeaderNavigationLink
|
|
89
74
|
id="titanAdvisor"
|
|
75
|
+
to="titanAdvisor"
|
|
90
76
|
iconName="rocket"
|
|
91
77
|
iconClassName={Styles.rocketIcon}
|
|
78
|
+
icon={SvgRocket}
|
|
79
|
+
iconActive={SvgRocketActive}
|
|
92
80
|
/>
|
|
93
81
|
|
|
94
82
|
<HeaderNavigationLink
|
|
95
83
|
id="settings"
|
|
96
|
-
to="
|
|
84
|
+
to="settings"
|
|
97
85
|
target="_blank"
|
|
98
86
|
iconName="settings"
|
|
99
87
|
aria-label="search"
|
|
100
88
|
hint="Settings"
|
|
101
|
-
|
|
89
|
+
icon={SvgSettings}
|
|
90
|
+
iconActive={SvgSettingsActive}
|
|
102
91
|
/>
|
|
103
92
|
|
|
104
93
|
<ProfileDropdown>
|
|
@@ -131,7 +120,6 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
131
120
|
</Stack>
|
|
132
121
|
}
|
|
133
122
|
leftClassName="d-f align-items-center"
|
|
134
|
-
navigationComponent={NavLinkMock}
|
|
135
123
|
right={
|
|
136
124
|
<Fragment>
|
|
137
125
|
<TimeZoneOffset />
|
|
@@ -142,24 +130,29 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
142
130
|
target="_blank"
|
|
143
131
|
iconComponent={SearchIcon}
|
|
144
132
|
hint="Search: for all the questions"
|
|
133
|
+
icon={SvgSearch}
|
|
134
|
+
iconActive={SvgSearch}
|
|
145
135
|
/>
|
|
146
136
|
|
|
147
|
-
<
|
|
137
|
+
<CallsNavigationTrigger />
|
|
148
138
|
|
|
149
|
-
<
|
|
139
|
+
<HeaderNavigationLink
|
|
150
140
|
id="titanAdvisor"
|
|
141
|
+
to="titanAdvisor"
|
|
151
142
|
iconName="rocket"
|
|
152
143
|
iconClassName={Styles.rocketIcon}
|
|
144
|
+
icon={SvgRocket}
|
|
145
|
+
iconActive={SvgRocketActive}
|
|
153
146
|
/>
|
|
154
147
|
|
|
155
148
|
<HeaderNavigationLink
|
|
156
149
|
id="settings"
|
|
157
|
-
to="
|
|
158
|
-
target="_blank"
|
|
150
|
+
to="settings"
|
|
159
151
|
iconName="settings"
|
|
160
152
|
aria-label="search"
|
|
161
153
|
hint="Settings"
|
|
162
|
-
|
|
154
|
+
icon={SvgSettings}
|
|
155
|
+
iconActive={SvgSettingsActive}
|
|
163
156
|
/>
|
|
164
157
|
|
|
165
158
|
<ProfileDropdown>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { FC, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import * as Styles from './header-navigation-tiny.module.less';
|
|
4
|
+
|
|
5
|
+
export interface HeaderNavigationTinyProps {
|
|
6
|
+
/** container class name */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** extra navigation */
|
|
9
|
+
right?: ReactNode;
|
|
10
|
+
/** extra navigation container class name */
|
|
11
|
+
rightClassName?: string;
|
|
12
|
+
/** container id */
|
|
13
|
+
id?: string;
|
|
14
|
+
/** left content (usually used for logo) */
|
|
15
|
+
left?: ReactElement;
|
|
16
|
+
/** left container class name */
|
|
17
|
+
leftClassName?: string;
|
|
18
|
+
/** center content */
|
|
19
|
+
center?: ReactElement;
|
|
20
|
+
/** center container class name */
|
|
21
|
+
centerClassName?: string;
|
|
22
|
+
/** minimal width for navigation bar */
|
|
23
|
+
minWidth?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const HeaderNavigationTiny: FC<HeaderNavigationTinyProps> = ({
|
|
27
|
+
className,
|
|
28
|
+
id,
|
|
29
|
+
left,
|
|
30
|
+
leftClassName,
|
|
31
|
+
right,
|
|
32
|
+
rightClassName,
|
|
33
|
+
center,
|
|
34
|
+
centerClassName,
|
|
35
|
+
minWidth = 800,
|
|
36
|
+
}) => {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
className={classNames(Styles.headerTiny, className)}
|
|
40
|
+
style={{ minWidth: `${minWidth}px` }}
|
|
41
|
+
id={id}
|
|
42
|
+
data-cy="header-navigation"
|
|
43
|
+
>
|
|
44
|
+
<div className={classNames(Styles.heTopLeft, leftClassName)} data-cy="navigation-left">
|
|
45
|
+
{left}
|
|
46
|
+
</div>
|
|
47
|
+
<div
|
|
48
|
+
className={classNames(Styles.heTopCenter, centerClassName)}
|
|
49
|
+
data-cy="navigation-center"
|
|
50
|
+
>
|
|
51
|
+
{center}
|
|
52
|
+
</div>
|
|
53
|
+
<div
|
|
54
|
+
className={classNames(
|
|
55
|
+
'd-f flex-row justify-content-end align-items-center',
|
|
56
|
+
Styles.heTopRight,
|
|
57
|
+
rightClassName
|
|
58
|
+
)}
|
|
59
|
+
data-cy="navigation-right"
|
|
60
|
+
>
|
|
61
|
+
{right}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -84,6 +84,16 @@
|
|
|
84
84
|
color: @text-color-active;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
&.navigation-item-icon-state.navigation-item-active {
|
|
88
|
+
.navigation-icon:not(.navigation-icon-active) {
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.navigation-icon.navigation-icon-active {
|
|
93
|
+
display: block;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
87
97
|
&:hover:not(.navigation-item-active) {
|
|
88
98
|
background-color: @bg-color-hover;
|
|
89
99
|
}
|
|
@@ -101,10 +111,19 @@
|
|
|
101
111
|
}
|
|
102
112
|
}
|
|
103
113
|
|
|
104
|
-
.navigation-icon {
|
|
114
|
+
.navigation-icon[data-anv][data-anv] {
|
|
105
115
|
height: 24px;
|
|
106
116
|
width: 24px;
|
|
107
|
-
|
|
117
|
+
color: inherit;
|
|
118
|
+
|
|
119
|
+
& > svg {
|
|
120
|
+
height: 24px;
|
|
121
|
+
width: 24px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&.navigation-icon-active {
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
108
127
|
}
|
|
109
128
|
|
|
110
129
|
.options-item {
|
|
@@ -127,12 +146,17 @@
|
|
|
127
146
|
background-color: @bg-color-hover;
|
|
128
147
|
}
|
|
129
148
|
|
|
130
|
-
.options-icon {
|
|
149
|
+
.options-icon-wrapper {
|
|
131
150
|
height: 24px;
|
|
132
151
|
width: 24px;
|
|
133
|
-
font-size: 24px;
|
|
134
152
|
padding-left: @spacing-1;
|
|
135
153
|
padding-right: @spacing-1;
|
|
154
|
+
|
|
155
|
+
.options-icon[data-anv][data-anv] > svg {
|
|
156
|
+
height: 24px;
|
|
157
|
+
width: 24px;
|
|
158
|
+
color: @text-color;
|
|
159
|
+
}
|
|
136
160
|
}
|
|
137
161
|
|
|
138
162
|
.options-item-text {
|
|
@@ -143,24 +167,6 @@
|
|
|
143
167
|
}
|
|
144
168
|
}
|
|
145
169
|
|
|
146
|
-
.options-popover-item-clickable {
|
|
147
|
-
cursor: pointer;
|
|
148
|
-
|
|
149
|
-
&:hover {
|
|
150
|
-
background-color: @color-neutral-60;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.options-popover-item-active {
|
|
155
|
-
background-color: @color-blue-100;
|
|
156
|
-
color: @color-blue-500;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.options-popover-item-inactive,
|
|
160
|
-
.options-popover-item-active {
|
|
161
|
-
border-radius: @border-radius-1;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
170
|
.divider {
|
|
165
171
|
border-top: 1px solid @border-color;
|
|
166
172
|
margin-left: 12px;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export const __esModule: true;
|
|
2
2
|
export const divider: string;
|
|
3
3
|
export const navigationIcon: string;
|
|
4
|
+
export const navigationIconActive: string;
|
|
4
5
|
export const navigationItem: string;
|
|
5
6
|
export const navigationItemActive: string;
|
|
6
7
|
export const navigationItemCounter: string;
|
|
8
|
+
export const navigationItemIconState: string;
|
|
7
9
|
export const navigationItemText: string;
|
|
8
10
|
export const optionsIcon: string;
|
|
11
|
+
export const optionsIconWrapper: string;
|
|
9
12
|
export const optionsItem: string;
|
|
10
13
|
export const optionsItemText: string;
|
|
11
|
-
export const optionsPopoverItemActive: string;
|
|
12
|
-
export const optionsPopoverItemClickable: string;
|
|
13
|
-
export const optionsPopoverItemInactive: string;
|
|
14
14
|
export const sideNav: string;
|
|
15
15
|
export const sideNavBottom: string;
|
|
16
16
|
export const sideNavContent: string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComponentType, useState } from 'react';
|
|
2
|
+
import { NavLinkMock, items, withAnvil, withMemoryRouter } from '../../test/data.stories';
|
|
3
|
+
import { SideNavigation } from './';
|
|
4
|
+
|
|
5
|
+
const layout = (Story: ComponentType) => {
|
|
6
|
+
return (
|
|
7
|
+
<div className="d-f border" style={{ height: '800px' }}>
|
|
8
|
+
<Story />
|
|
9
|
+
<div className="flex-grow-1 flex-basis-0" />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Navigation/SideNavigation',
|
|
15
|
+
component: SideNavigation,
|
|
16
|
+
decorators: [layout, withMemoryRouter, withAnvil],
|
|
17
|
+
parameters: {},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const DefaultSideNavigation = () => {
|
|
21
|
+
const [expanded, setExpanded] = useState(false);
|
|
22
|
+
return (
|
|
23
|
+
<SideNavigation
|
|
24
|
+
navigationComponent={NavLinkMock}
|
|
25
|
+
expanded={expanded}
|
|
26
|
+
onExpandedChange={setExpanded}
|
|
27
|
+
items={[
|
|
28
|
+
items.dashboard,
|
|
29
|
+
items.calendar,
|
|
30
|
+
items.calls,
|
|
31
|
+
items.accounting,
|
|
32
|
+
items.dispatch,
|
|
33
|
+
|
|
34
|
+
items.fleet,
|
|
35
|
+
items.followUps,
|
|
36
|
+
items.inventory,
|
|
37
|
+
|
|
38
|
+
items.marketing,
|
|
39
|
+
items.priceBook,
|
|
40
|
+
items.pointOfSale,
|
|
41
|
+
items.reports,
|
|
42
|
+
]}
|
|
43
|
+
itemsTop={[items.tasks]}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
};
|