@servicetitan/navigation 11.0.0-canary.237.6ce8e81.0 → 11.0.0-canary.237.7d5e2c9.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/badge-tag.d.ts +1 -1
- package/dist/components/badge-tag.d.ts.map +1 -1
- package/dist/components/logo/logo-titan-text.d.ts +1 -1
- package/dist/components/logo/logo-titan-text.d.ts.map +1 -1
- 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 +2 -2
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +2 -0
- package/dist/components/titan-layout/layout-context.js +1 -1
- package/dist/components/titan-layout/layout-context.js.map +1 -1
- package/dist/components/titan-layout/layout-header.d.ts +2 -0
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js +3 -4
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +55 -36
- package/dist/components/titan-layout/layout-logo.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-logo.js +2 -1
- package/dist/components/titan-layout/layout-logo.js.map +1 -1
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +20 -5
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-profile.stories.js +1 -1
- package/dist/components/titan-layout/layout-profile.stories.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +2 -2
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +4 -4
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +9 -2
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts +2 -0
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +6 -4
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.module.less +25 -5
- package/dist/components/titan-layout/notifications-context.d.ts +13 -0
- package/dist/components/titan-layout/notifications-context.d.ts.map +1 -0
- package/dist/components/titan-layout/notifications-context.js +23 -0
- package/dist/components/titan-layout/notifications-context.js.map +1 -0
- package/dist/components/titan-layout/titan-layout.d.ts +6 -3
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +77 -22
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.module.less +29 -7
- package/dist/components/titan-layout/titan-layout.stories.d.ts +2 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.stories.js +8 -5
- package/dist/components/titan-layout/titan-layout.stories.js.map +1 -1
- package/dist/test/data.d.ts +4 -1
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +2 -3
- package/dist/test/data.js.map +1 -1
- package/dist/utils/use-breakpoint.d.ts +1 -0
- package/dist/utils/use-breakpoint.d.ts.map +1 -1
- package/dist/utils/use-breakpoint.js +3 -2
- package/dist/utils/use-breakpoint.js.map +1 -1
- package/package.json +2 -2
- package/src/components/badge-tag.tsx +1 -1
- package/src/components/logo/logo-titan-text.tsx +1 -1
- package/src/components/profile-dropdown/profile-dropdown.module.less +2 -0
- package/src/components/profile-dropdown/profile-dropdown.tsx +5 -1
- package/src/components/titan-layout/layout-context.tsx +1 -1
- package/src/components/titan-layout/layout-header.module.less +55 -36
- package/src/components/titan-layout/layout-header.module.less.d.ts +2 -0
- package/src/components/titan-layout/layout-header.tsx +12 -5
- package/src/components/titan-layout/layout-logo.tsx +13 -6
- package/src/components/titan-layout/layout-profile.stories.tsx +1 -1
- package/src/components/titan-layout/layout-profile.tsx +42 -19
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +18 -5
- package/src/components/titan-layout/layout-sidebar-links.tsx +11 -2
- package/src/components/titan-layout/layout-sidebar.module.less +25 -5
- package/src/components/titan-layout/layout-sidebar.module.less.d.ts +1 -0
- package/src/components/titan-layout/layout-sidebar.tsx +14 -5
- package/src/components/titan-layout/notifications-context.tsx +44 -0
- package/src/components/titan-layout/titan-layout.module.less +29 -7
- package/src/components/titan-layout/titan-layout.module.less.d.ts +2 -1
- package/src/components/titan-layout/titan-layout.stories.tsx +13 -4
- package/src/components/titan-layout/titan-layout.tsx +212 -93
- package/src/test/data.tsx +2 -3
- package/src/utils/use-breakpoint.ts +3 -1
package/dist/test/data.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { NavLinkComponentProps } from '../utils/navigation-context';
|
|
2
3
|
import { HeaderNavigationItemData } from '../utils/navigation-legacy';
|
|
3
4
|
export declare const NavLinkMock: import("react").ForwardRefExoticComponent<Omit<NavLinkComponentProps, "ref"> & import("react").RefAttributes<any>>;
|
|
4
|
-
export declare const LocationInfo:
|
|
5
|
+
export declare const LocationInfo: FC<{
|
|
6
|
+
className?: string;
|
|
7
|
+
}>;
|
|
5
8
|
export declare const withMemoryRouter: (Story: any) => import("react/jsx-runtime").JSX.Element;
|
|
6
9
|
export declare const withAnvil: (Story: any) => import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
export declare const InventoryIcon: () => import("react/jsx-runtime").JSX.Element;
|
package/dist/test/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/test/data.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/test/data.tsx"],"names":[],"mappings":"AAmCA,OAAO,EAAE,EAAE,EAA2C,MAAM,OAAO,CAAC;AAapE,OAAO,EACH,qBAAqB,EAIxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,eAAO,MAAM,WAAW,oHAwBvB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAInD,CAAC;AAkBF,eAAO,MAAM,gBAAgB,GAAI,OAAO,GAAG,4CAQ1C,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,GAAG,4CAInC,CAAC;AAEF,eAAO,MAAM,aAAa,+CAKzB,CAAC;AAEF,eAAO,MAAM,UAAU,+CAetB,CAAC;AA6CF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;CAyIjB,CAAC;AAEF,eAAO,MAAM,sBAAsB,+CAwBlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,OAAO,GAAG,4CAS9C,CAAC"}
|
package/dist/test/data.js
CHANGED
|
@@ -45,15 +45,14 @@ export const NavLinkMock = forwardRef(({ to, children, activeClassName, classNam
|
|
|
45
45
|
const linkActive = location.pathname.startsWith(to);
|
|
46
46
|
return (_jsx("a", { ...rest, onClick: e => {
|
|
47
47
|
e.preventDefault();
|
|
48
|
-
e.stopPropagation();
|
|
49
48
|
if (!to.startsWith('http')) {
|
|
50
49
|
history.replace(to);
|
|
51
50
|
}
|
|
52
51
|
}, className: classNames(className, linkActive ? activeClassName : ''), href: to, ref: ref, children: children }));
|
|
53
52
|
});
|
|
54
|
-
export const LocationInfo = () => {
|
|
53
|
+
export const LocationInfo = ({ className }) => {
|
|
55
54
|
const location = useLocation();
|
|
56
|
-
return _jsxs(BodyText, { children: ["current location - ", location.pathname] });
|
|
55
|
+
return _jsxs(BodyText, { className: className, children: ["current location - ", location.pathname] });
|
|
57
56
|
};
|
|
58
57
|
const LocationProvider = ({ children }) => {
|
|
59
58
|
const location = useLocation();
|
package/dist/test/data.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/test/data.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,QAAQ,MAAM,qEAAqE,CAAC;AAC3F,OAAO,cAAc,MAAM,oEAAoE,CAAC;AAChG,OAAO,mBAAmB,MAAM,iEAAiE,CAAC;AAClG,OAAO,aAAa,MAAM,mEAAmE,CAAC;AAC9F,OAAO,cAAc,MAAM,4DAA4D,CAAC;AACxF,OAAO,QAAQ,MAAM,8DAA8D,CAAC;AACpF,OAAO,kBAAkB,MAAM,gEAAgE,CAAC;AAChG,OAAO,YAAY,MAAM,kEAAkE,CAAC;AAC5F,OAAO,iBAAiB,MAAM,+DAA+D,CAAC;AAC9F,OAAO,WAAW,MAAM,iEAAiE,CAAC;AAC1F,OAAO,iBAAiB,MAAM,gEAAgE,CAAC;AAC/F,OAAO,WAAW,MAAM,kEAAkE,CAAC;AAC3F,OAAO,iBAAiB,MAAM,gEAAgE,CAAC;AAC/F,OAAO,WAAW,MAAM,kEAAkE,CAAC;AAC3F,OAAO,kBAAkB,MAAM,gEAAgE,CAAC;AAChG,OAAO,YAAY,MAAM,kEAAkE,CAAC;AAC5F,OAAO,kBAAkB,MAAM,gEAAgE,CAAC;AAChG,OAAO,YAAY,MAAM,kEAAkE,CAAC;AAC5F,OAAO,YAAY,MAAM,0DAA0D,CAAC;AACpF,OAAO,MAAM,MAAM,4DAA4D,CAAC;AAChF,OAAO,kBAAkB,MAAM,gEAAgE,CAAC;AAChG,OAAO,YAAY,MAAM,kEAAkE,CAAC;AAC5F,OAAO,iBAAiB,MAAM,+DAA+D,CAAC;AAC9F,OAAO,WAAW,MAAM,iEAAiE,CAAC;AAC1F,OAAO,gBAAgB,MAAM,8DAA8D,CAAC;AAC5F,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EAAE,EAAC,SAAS,EACZ,QAAQ,EAAC,OAAO,EAChB,OAAO,EAAE,CAAC,EACV,KAAK,EAAC,OAAO,EACb,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAC7B,QAAQ,EAAE,IAAI,GAChB,8BAIA,CACb,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CAChD,MAAC,QAAQ,eACL,MAAC,MAAM,eACH,KAAC,QAAQ,IAAC,IAAI,EAAC,aAAa,EAAC,KAAK,QAAC,EAAE,EAAC,oBAAoB,GAAG,EAC7D,KAAC,QAAQ,IAAC,IAAI,EAAC,aAAa,EAAC,KAAK,QAAC,EAAE,EAAC,kBAAkB,GAAG,EAC3D,KAAC,QAAQ,IAAC,IAAI,EAAC,YAAY,EAAC,KAAK,QAAC,EAAE,EAAC,iBAAiB,GAAG,IACpD,EACT,KAAC,KAAK,KAAG,IACF,CACd,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { BreakpointReturnProps } from '@servicetitan/anvil2';
|
|
|
2
2
|
export interface TitanBreakpoint {
|
|
3
3
|
name: BreakpointReturnProps['name'];
|
|
4
4
|
isMobile: boolean;
|
|
5
|
+
width: number;
|
|
5
6
|
}
|
|
6
7
|
export declare const useTitanBreakpoint: () => TitanBreakpoint;
|
|
7
8
|
//# sourceMappingURL=use-breakpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-breakpoint.d.ts","sourceRoot":"","sources":["../../src/utils/use-breakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAiB,MAAM,sBAAsB,CAAC;AAG5E,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-breakpoint.d.ts","sourceRoot":"","sources":["../../src/utils/use-breakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAiB,MAAM,sBAAsB,CAAC;AAG5E,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,kBAAkB,QAAO,eAWrC,CAAC"}
|
|
@@ -3,10 +3,11 @@ import { useMemo } from 'react';
|
|
|
3
3
|
export const useTitanBreakpoint = () => {
|
|
4
4
|
const breakpoint = useBreakpoint();
|
|
5
5
|
return useMemo(() => {
|
|
6
|
-
var _a;
|
|
6
|
+
var _a, _b;
|
|
7
7
|
return ({
|
|
8
8
|
name: (_a = breakpoint === null || breakpoint === void 0 ? void 0 : breakpoint.name) !== null && _a !== void 0 ? _a : 'xl',
|
|
9
|
-
isMobile: breakpoint ? breakpoint.innerWidth
|
|
9
|
+
isMobile: breakpoint ? breakpoint.innerWidth < 768 : false,
|
|
10
|
+
width: (_b = breakpoint === null || breakpoint === void 0 ? void 0 : breakpoint.innerWidth) !== null && _b !== void 0 ? _b : 0,
|
|
10
11
|
});
|
|
11
12
|
}, [breakpoint]);
|
|
12
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-breakpoint.js","sourceRoot":"","sources":["../../src/utils/use-breakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-breakpoint.js","sourceRoot":"","sources":["../../src/utils/use-breakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAoB,EAAE;IACpD,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IAEnC,OAAO,OAAO,CACV,GAAG,EAAE;;QAAC,OAAA,CAAC;YACH,IAAI,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,mCAAI,IAAI;YAC9B,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK;YAC1D,KAAK,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,mCAAI,CAAC;SACrC,CAAC,CAAA;KAAA,EACF,CAAC,UAAU,CAAC,CACf,CAAC;AACN,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/navigation",
|
|
3
|
-
"version": "11.0.0-canary.237.
|
|
3
|
+
"version": "11.0.0-canary.237.7d5e2c9.0",
|
|
4
4
|
"description": "Navigation components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"less": true,
|
|
43
43
|
"webpack": false
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "7d5e2c9a3547a4d61a5ef937f36ceb050bcff01d"
|
|
46
46
|
}
|
|
@@ -3,7 +3,7 @@ import { CSSProperties, FC, ReactNode } from 'react';
|
|
|
3
3
|
import { LogoTitanSvg } from './logo-titan';
|
|
4
4
|
import * as Styles from './logo-titan-text.module.less';
|
|
5
5
|
|
|
6
|
-
export type WrapperProps = FC<{ className
|
|
6
|
+
export type WrapperProps = FC<{ className?: string; children: ReactNode; style?: CSSProperties }>;
|
|
7
7
|
|
|
8
8
|
export interface LogoTitanProps {
|
|
9
9
|
mantleFill?: string;
|
|
@@ -148,7 +148,9 @@ const ProfileDropdownTrigger: FC<ProfileDropdownTriggerProps> = ({
|
|
|
148
148
|
);
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
-
export type ProfileItemContent =
|
|
151
|
+
export type ProfileItemContent =
|
|
152
|
+
| { children: string; text?: string }
|
|
153
|
+
| { children: ReactNode; text: string };
|
|
152
154
|
|
|
153
155
|
export interface ProfileDropdownSectionPropsStrict {
|
|
154
156
|
children: ReactNode;
|
|
@@ -166,6 +168,7 @@ export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
|
166
168
|
children,
|
|
167
169
|
className,
|
|
168
170
|
id,
|
|
171
|
+
text,
|
|
169
172
|
tooltip,
|
|
170
173
|
onClick,
|
|
171
174
|
...rest
|
|
@@ -221,6 +224,7 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
221
224
|
counter,
|
|
222
225
|
tag,
|
|
223
226
|
target,
|
|
227
|
+
text,
|
|
224
228
|
to,
|
|
225
229
|
tooltip,
|
|
226
230
|
onClick,
|
|
@@ -19,7 +19,7 @@ export interface TitanLayoutContextType {
|
|
|
19
19
|
|
|
20
20
|
export const LayoutContext = createContext<TitanLayoutContextType>({
|
|
21
21
|
NavigationComponent: DefaultNavLinkComponent,
|
|
22
|
-
breakpoint: { name: 'lg', isMobile: false },
|
|
22
|
+
breakpoint: { name: 'lg', isMobile: false, width: 0 },
|
|
23
23
|
isTitanLayout: false,
|
|
24
24
|
sidebar: { styles: { popoverContent: {} } },
|
|
25
25
|
});
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
@size-links-tiny: 24px;
|
|
5
5
|
|
|
6
6
|
.header {
|
|
7
|
+
--nav-top-content-height: 32px;
|
|
7
8
|
display: flex;
|
|
8
9
|
justify-content: space-between;
|
|
9
10
|
|
|
10
11
|
background-color: @color-white;
|
|
11
12
|
color: @color-black;
|
|
12
|
-
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
outline: 1px solid @color-neutral-60;
|
|
13
15
|
|
|
14
16
|
& > * {
|
|
15
17
|
overflow-y: hidden;
|
|
@@ -20,6 +22,10 @@
|
|
|
20
22
|
align-items: center;
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
.he-top-center {
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
.he-top-right {
|
|
24
30
|
& > * {
|
|
25
31
|
color: @color-black;
|
|
@@ -84,29 +90,59 @@
|
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
|
|
93
|
+
.header-mobile {
|
|
94
|
+
padding: @spacing-2 @spacing-0;
|
|
95
|
+
height: var(--nav-offset-top);
|
|
96
|
+
|
|
97
|
+
--nav-top-content-height: 40px;
|
|
98
|
+
|
|
99
|
+
.navigation-link {
|
|
100
|
+
padding: 10px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.he-top-center {
|
|
104
|
+
max-width: unset;
|
|
105
|
+
flex: 1;
|
|
106
|
+
margin-left: @spacing-3;
|
|
107
|
+
margin-right: @spacing-3;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.he-top-left {
|
|
111
|
+
margin-left: @spacing-half;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.he-top-right {
|
|
115
|
+
margin-right: @spacing-half;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
87
119
|
// desktop
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
padding: 6px 6px;
|
|
94
|
-
}
|
|
120
|
+
.header-desktop {
|
|
121
|
+
height: var(--nav-offset-top);
|
|
122
|
+
.navigation-link {
|
|
123
|
+
margin: 6px 2px;
|
|
124
|
+
padding: 6px 6px;
|
|
95
125
|
|
|
96
|
-
.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
.he-top-center {
|
|
100
|
-
flex: 1;
|
|
101
|
-
margin-left: @spacing-2;
|
|
102
|
-
margin-right: @spacing-2;
|
|
103
|
-
max-width: 400px;
|
|
126
|
+
.navigation-item-counter {
|
|
127
|
+
min-width: 12px !important;
|
|
128
|
+
height: 12px !important;
|
|
104
129
|
}
|
|
105
130
|
}
|
|
131
|
+
|
|
132
|
+
.he-top-left {
|
|
133
|
+
padding-left: @spacing-1;
|
|
134
|
+
}
|
|
135
|
+
.he-top-center {
|
|
136
|
+
flex: 1;
|
|
137
|
+
margin-left: @spacing-2;
|
|
138
|
+
margin-right: @spacing-2;
|
|
139
|
+
max-width: 400px;
|
|
140
|
+
}
|
|
106
141
|
}
|
|
142
|
+
|
|
107
143
|
// desktop wide
|
|
108
144
|
@media only screen and (min-width: 1200px) {
|
|
109
|
-
.header {
|
|
145
|
+
.header-desktop {
|
|
110
146
|
display: grid;
|
|
111
147
|
grid-template-columns: repeat(3, 1fr);
|
|
112
148
|
grid-template-rows: 48px;
|
|
@@ -123,24 +159,6 @@
|
|
|
123
159
|
}
|
|
124
160
|
}
|
|
125
161
|
|
|
126
|
-
// mobile
|
|
127
|
-
@media only screen and (max-width: 768px) {
|
|
128
|
-
.header {
|
|
129
|
-
padding: @spacing-1 @spacing-half;
|
|
130
|
-
|
|
131
|
-
.navigation-link {
|
|
132
|
-
padding: 10px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.he-top-center {
|
|
136
|
-
max-width: unset;
|
|
137
|
-
flex: 1;
|
|
138
|
-
margin-left: @spacing-3;
|
|
139
|
-
margin-right: @spacing-3;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
162
|
.navigation-link {
|
|
145
163
|
// styles specific to extra nav links
|
|
146
164
|
color: @color-black;
|
|
@@ -154,7 +172,8 @@
|
|
|
154
172
|
color: @color-white;
|
|
155
173
|
font-weight: @font-weight-semibold;
|
|
156
174
|
font-size: 8px !important;
|
|
157
|
-
min-width:
|
|
175
|
+
min-width: 16px !important;
|
|
176
|
+
height: 16px !important;
|
|
158
177
|
position: absolute;
|
|
159
178
|
top: 4px;
|
|
160
179
|
right: -2px;
|
|
@@ -4,6 +4,8 @@ export const heTopLeft: string;
|
|
|
4
4
|
export const heTopRight: string;
|
|
5
5
|
export const heTopRightText: string;
|
|
6
6
|
export const header: string;
|
|
7
|
+
export const headerDesktop: string;
|
|
8
|
+
export const headerMobile: string;
|
|
7
9
|
export const navigationIcon: string;
|
|
8
10
|
export const navigationIconActive: string;
|
|
9
11
|
export const navigationItemActive: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import SvgBurgerMenu from '@servicetitan/anvil2/assets/icons/material/round/menu.svg';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { ComponentPropsWithoutRef, FC, ReactElement, ReactNode } from 'react';
|
|
4
|
-
import { LayoutPlacementContext
|
|
4
|
+
import { LayoutPlacementContext } from './layout-context';
|
|
5
5
|
import { LayoutHeaderNavigationTrigger } from './layout-header-links';
|
|
6
6
|
import * as Styles from './layout-header.module.less';
|
|
7
7
|
import { TitanLayoutLogoProps } from './layout-logo';
|
|
@@ -25,6 +25,8 @@ export type LayoutHeaderProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'
|
|
|
25
25
|
logo: ReactElement<TitanLayoutLogoProps>;
|
|
26
26
|
profile?: ReactElement;
|
|
27
27
|
|
|
28
|
+
isMobile: boolean;
|
|
29
|
+
hasNotifications: boolean;
|
|
28
30
|
onBurgerClick?: (e: MouseEvent) => void;
|
|
29
31
|
};
|
|
30
32
|
|
|
@@ -35,22 +37,26 @@ export const LayoutHeader: FC<LayoutHeaderProps> = ({
|
|
|
35
37
|
rightClassName,
|
|
36
38
|
center,
|
|
37
39
|
centerClassName,
|
|
40
|
+
isMobile,
|
|
41
|
+
hasNotifications,
|
|
38
42
|
logo,
|
|
39
43
|
profile,
|
|
40
44
|
onBurgerClick,
|
|
41
45
|
...rest
|
|
42
46
|
}) => {
|
|
43
|
-
const { breakpoint } = useTitanLayoutContext();
|
|
44
|
-
|
|
45
47
|
return (
|
|
46
48
|
<LayoutPlacementContext.Provider value="top">
|
|
47
49
|
<div
|
|
48
|
-
className={classNames(
|
|
50
|
+
className={classNames(
|
|
51
|
+
Styles.header,
|
|
52
|
+
isMobile ? Styles.headerMobile : Styles.headerDesktop,
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
49
55
|
{...rest}
|
|
50
56
|
data-cy="header-navigation"
|
|
51
57
|
>
|
|
52
58
|
<div className={classNames(Styles.heTopLeft)} data-cy="navigation-left">
|
|
53
|
-
{
|
|
59
|
+
{isMobile && (
|
|
54
60
|
<LayoutHeaderNavigationTrigger
|
|
55
61
|
id="burger"
|
|
56
62
|
title=""
|
|
@@ -58,6 +64,7 @@ export const LayoutHeader: FC<LayoutHeaderProps> = ({
|
|
|
58
64
|
iconActive={SvgBurgerMenu}
|
|
59
65
|
className="m-r-1"
|
|
60
66
|
onClick={onBurgerClick}
|
|
67
|
+
tag={{ value: hasNotifications }}
|
|
61
68
|
/>
|
|
62
69
|
)}
|
|
63
70
|
{logo}
|
|
@@ -33,20 +33,27 @@ export const TitanLayoutLogo: FC<TitanLayoutLogoProps> = ({
|
|
|
33
33
|
const Wrapper = logoWrapper;
|
|
34
34
|
const logoSize = isMobile ? 44 : 56;
|
|
35
35
|
const logoCompanySize = 48;
|
|
36
|
+
const showCompanyTitle = title === true && !isMobile;
|
|
36
37
|
|
|
37
38
|
return (
|
|
38
|
-
<div
|
|
39
|
-
{
|
|
39
|
+
<div
|
|
40
|
+
className={classNames(
|
|
41
|
+
'd-f align-items-center',
|
|
42
|
+
{ 'p-t-half': showCompanyTitle },
|
|
43
|
+
className
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
{showCompanyTitle ? (
|
|
47
|
+
<Wrapper>
|
|
48
|
+
<LogoCompanyTitle height={logoCompanySize} />
|
|
49
|
+
</Wrapper>
|
|
50
|
+
) : typeof title === 'string' ? (
|
|
40
51
|
<Fragment>
|
|
41
52
|
<LogoTitan size={logoSize} mantleFill={mantleFill} logoWrapper={Wrapper} />
|
|
42
53
|
{!isMobile && (
|
|
43
54
|
<LogoTitanTitle className="c-inherit m-l-1">{title}</LogoTitanTitle>
|
|
44
55
|
)}
|
|
45
56
|
</Fragment>
|
|
46
|
-
) : title === true && !isMobile ? (
|
|
47
|
-
<Wrapper className="">
|
|
48
|
-
<LogoCompanyTitle height={logoCompanySize} />
|
|
49
|
-
</Wrapper>
|
|
50
57
|
) : (
|
|
51
58
|
<LogoTitan size={logoSize} mantleFill={mantleFill} logoWrapper={Wrapper} />
|
|
52
59
|
)}
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
|
|
19
19
|
export const ProfileDefault = withTitanLayout(
|
|
20
20
|
<ProfileDropdown>
|
|
21
|
-
<ProfileDropdown.Link id="first" to="https://google.com">
|
|
21
|
+
<ProfileDropdown.Link id="first" to="https://google.com" external>
|
|
22
22
|
first link
|
|
23
23
|
</ProfileDropdown.Link>
|
|
24
24
|
<ProfileDropdown.Section id="second" onClick={() => alert('second click')}>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';
|
|
2
2
|
import SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';
|
|
3
3
|
|
|
4
|
-
import { FC, useState } from 'react';
|
|
5
|
-
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
4
|
+
import { FC, MouseEvent, useEffect, useState } from 'react';
|
|
5
|
+
import { NavLinkComponentProps, NavigationComponentContext } from '../../utils/navigation-context';
|
|
6
6
|
import {
|
|
7
7
|
ProfileDropdown as DesktopProfileDropdown,
|
|
8
8
|
ProfileDropdownLinkProps,
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
InternalSideNavigationGroupLink,
|
|
18
18
|
InternalSideNavigationGroupTrigger,
|
|
19
19
|
} from './layout-sidebar-links-internal';
|
|
20
|
+
import { useNotificationsContext, useNotificationsState } from './notifications-context';
|
|
20
21
|
|
|
21
22
|
export type {
|
|
22
23
|
ProfileDropdownProps,
|
|
@@ -24,6 +25,10 @@ export type {
|
|
|
24
25
|
ProfileDropdownLinkProps,
|
|
25
26
|
} from '../profile-dropdown/profile-dropdown';
|
|
26
27
|
|
|
28
|
+
const ExternalNavComponent: FC<NavLinkComponentProps> = ({ children, isActive, ...props }) => (
|
|
29
|
+
<a {...props}>{children}</a>
|
|
30
|
+
);
|
|
31
|
+
|
|
27
32
|
const ProfileDropdownContent: FC<ProfileDropdownProps> = props => {
|
|
28
33
|
const { breakpoint, NavigationComponent } = useTitanLayoutContext();
|
|
29
34
|
return breakpoint.isMobile ? (
|
|
@@ -40,24 +45,37 @@ const MobileProfileDropdown: FC<ProfileDropdownProps & NavigationComponentProps>
|
|
|
40
45
|
children,
|
|
41
46
|
...props
|
|
42
47
|
}) => {
|
|
48
|
+
const id = '__profile';
|
|
43
49
|
const [expanded, setExpanded] = useState(false);
|
|
44
|
-
const
|
|
50
|
+
const { hasNotifications, NotificationsContextProvider } = useNotificationsState();
|
|
51
|
+
const { onNotificationsUpdate } = useNotificationsContext();
|
|
52
|
+
const onExpandToggle = (e: MouseEvent<never>) => {
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
setExpanded(!expanded);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
onNotificationsUpdate(id, hasNotifications);
|
|
59
|
+
}, [hasNotifications, onNotificationsUpdate]);
|
|
60
|
+
|
|
45
61
|
return (
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
<NotificationsContextProvider>
|
|
63
|
+
<InternalSideNavigationGroup
|
|
64
|
+
id={id}
|
|
65
|
+
to={undefined}
|
|
66
|
+
title="Profile"
|
|
67
|
+
icon={SvgAccountInactive}
|
|
68
|
+
iconActive={SvgAccountActive}
|
|
69
|
+
isActive={expanded}
|
|
70
|
+
{...props}
|
|
71
|
+
submenuExpanded={expanded}
|
|
72
|
+
onExpandToggle={onExpandToggle}
|
|
73
|
+
onClick={onExpandToggle}
|
|
74
|
+
tag={{ value: hasNotifications }}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
</InternalSideNavigationGroup>
|
|
78
|
+
</NotificationsContextProvider>
|
|
61
79
|
);
|
|
62
80
|
};
|
|
63
81
|
|
|
@@ -106,17 +124,22 @@ const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = props => {
|
|
|
106
124
|
);
|
|
107
125
|
};
|
|
108
126
|
const MobileProfileDropdownLink: FC<ProfileDropdownLinkProps & NavigationComponentProps> = ({
|
|
127
|
+
external,
|
|
109
128
|
to,
|
|
110
129
|
navigationComponent,
|
|
111
130
|
...props
|
|
112
131
|
}) => {
|
|
132
|
+
const { onNotificationsUpdate } = useNotificationsContext();
|
|
113
133
|
const text = getText(props);
|
|
134
|
+
const isExternalLink = external ?? to?.startsWith('http');
|
|
135
|
+
onNotificationsUpdate(props.id, !!props.tag?.value);
|
|
136
|
+
|
|
114
137
|
return text ? (
|
|
115
138
|
<InternalSideNavigationGroupLink
|
|
116
139
|
{...props}
|
|
117
140
|
to={to}
|
|
118
141
|
title={text}
|
|
119
|
-
navigationComponent={navigationComponent}
|
|
142
|
+
navigationComponent={isExternalLink ? ExternalNavComponent : navigationComponent}
|
|
120
143
|
/>
|
|
121
144
|
) : null;
|
|
122
145
|
};
|
|
@@ -156,7 +156,9 @@ export const InternalSideNavigationLink: FC<InternalSideNavigationLinkProps> = (
|
|
|
156
156
|
|
|
157
157
|
/** Side Navigation menu trigger (for internal usage) */
|
|
158
158
|
export const InternalSideNavigationTrigger: FC<
|
|
159
|
-
Omit<InternalSideNavigationLinkProps, 'to' | 'navigationComponent'> & {
|
|
159
|
+
Omit<InternalSideNavigationLinkProps, 'to' | 'navigationComponent'> & {
|
|
160
|
+
onClick?: (e: MouseEvent<never>) => void;
|
|
161
|
+
}
|
|
160
162
|
> = ({ className, dataPrefix, isActive, submenuExpanded, onExpandToggle, onClick, ...props }) => {
|
|
161
163
|
return (
|
|
162
164
|
<div
|
|
@@ -180,12 +182,22 @@ export const InternalSideNavigationTrigger: FC<
|
|
|
180
182
|
|
|
181
183
|
export const InternalSideNavigationGroupLink: FC<
|
|
182
184
|
NavigationSubmenuItemData & NavigationComponentProps
|
|
183
|
-
> = ({
|
|
185
|
+
> = ({
|
|
186
|
+
id,
|
|
187
|
+
counter,
|
|
188
|
+
tag,
|
|
189
|
+
title,
|
|
190
|
+
to,
|
|
191
|
+
isActive,
|
|
192
|
+
navigationComponent: NavigationComponent,
|
|
193
|
+
...rest
|
|
194
|
+
}) => {
|
|
184
195
|
return (
|
|
185
196
|
<NavigationComponent
|
|
197
|
+
key={id}
|
|
186
198
|
data-cy={`navigation-item-${id}`}
|
|
187
199
|
data-pendo={`navigation-item-${id}`}
|
|
188
|
-
|
|
200
|
+
{...rest}
|
|
189
201
|
to={to}
|
|
190
202
|
className={classNames(Styles.submenuItem, Styles.submenuLink, {
|
|
191
203
|
[Styles.submenuLinkActive]: isActive === true,
|
|
@@ -201,12 +213,13 @@ export const InternalSideNavigationGroupLink: FC<
|
|
|
201
213
|
|
|
202
214
|
export const InternalSideNavigationGroupTrigger: FC<
|
|
203
215
|
Omit<NavigationSubmenuItemData, 'to'> & { onClick?: (e: MouseEvent<any>) => void }
|
|
204
|
-
> = ({ id, counter, onClick, tag, title, isActive }) => {
|
|
216
|
+
> = ({ id, counter, onClick, tag, title, isActive, ...rest }) => {
|
|
205
217
|
return (
|
|
206
218
|
<div
|
|
207
219
|
data-cy={`navigation-item-${id}`}
|
|
208
220
|
data-pendo={`navigation-item-${id}`}
|
|
209
221
|
key={id}
|
|
222
|
+
{...rest}
|
|
210
223
|
className={classNames(Styles.submenuItem, {
|
|
211
224
|
[Styles.submenuLink]: !!onClick,
|
|
212
225
|
[Styles.submenuLinkActive]: isActive === true,
|
|
@@ -231,7 +244,7 @@ export const InternalSideNavigationGroup: FC<
|
|
|
231
244
|
onExpandToggle?: (e: MouseEvent<never>) => void;
|
|
232
245
|
tag: BadgeTagProps | undefined;
|
|
233
246
|
to: NavigationItemData['to'] | undefined;
|
|
234
|
-
onClick?: () => void;
|
|
247
|
+
onClick?: (e: MouseEvent<never>) => void;
|
|
235
248
|
}
|
|
236
249
|
> = ({ children, submenuExpanded, to, onExpandToggle, onClick, ...props }) => {
|
|
237
250
|
return (
|