@servicetitan/navigation 11.0.0-canary.237.dd4db7e.0 → 11.0.0-canary.237.f834dab.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/profile-dropdown/profile-dropdown.d.ts +2 -0
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +4 -3
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +1 -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.map +1 -1
- package/dist/components/titan-layout/layout-header.js +1 -1
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +47 -54
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +18 -14
- package/dist/components/titan-layout/layout-profile.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 +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +42 -11
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.module.less +2 -3
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.stories.js +1 -1
- package/dist/components/titan-layout/titan-layout.stories.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/profile-dropdown/profile-dropdown.module.less +1 -0
- package/src/components/profile-dropdown/profile-dropdown.tsx +10 -0
- package/src/components/titan-layout/layout-context.tsx +1 -1
- package/src/components/titan-layout/layout-header.module.less +47 -54
- package/src/components/titan-layout/layout-header.module.less.d.ts +2 -0
- package/src/components/titan-layout/layout-header.tsx +5 -1
- package/src/components/titan-layout/layout-profile.tsx +42 -15
- package/src/components/titan-layout/layout-sidebar-links.tsx +5 -1
- package/src/components/titan-layout/titan-layout.module.less +2 -3
- package/src/components/titan-layout/titan-layout.stories.tsx +1 -0
- package/src/components/titan-layout/titan-layout.tsx +111 -38
- package/src/utils/use-breakpoint.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"titan-layout.stories.js","sourceRoot":"","sources":["../../../src/components/titan-layout/titan-layout.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,SAAS,MAAM,6DAA6D,CAAC;AACpF,OAAO,QAAQ,MAAM,qDAAqD,CAAC;AAC3E,OAAO,iBAAiB,MAAM,+DAA+D,CAAC;AAC9F,OAAO,WAAW,MAAM,iEAAiE,CAAC;AAC1F,OAAO,eAAe,MAAM,oEAAoE,CAAC;AACjG,OAAO,SAAS,MAAM,sEAAsE,CAAC;AAC7F,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAM,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EACH,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,gBAAgB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAsC,MAAM,IAAI,CAAC;AAatF,eAAe;IACX,KAAK,EAAE,wBAAwB;IAC/B,UAAU,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,SAAS,CAAC;IAC/D,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACF,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;KACG;CACzB,CAAC;AAEF,MAAM,YAAY,GAAG;IACjB,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,QAAQ;IACd,KAAK,CAAC,KAAK;IACX,KAAK,CAAC,qBAAqB;IAC3B,KAAK,CAAC,QAAQ;IAEd,KAAK,CAAC,KAAK;IACX,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,SAAS;IAEf,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,WAAW;IACjB,KAAK,CAAC,OAAO;CAChB,CAAC;AAEF,MAAM,OAAO,GAAG,CACZ,MAAC,eAAe,eACZ,KAAC,eAAe,CAAC,IAAI,IACjB,EAAE,EAAC,OAAO,EACV,EAAE,EAAC,oBAAoB,EACvB,OAAO,EAAC,WAAW,EACnB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,2BAGD,EACvB,KAAC,eAAe,CAAC,OAAO,IACpB,EAAE,EAAC,QAAQ,EACX,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,EACpC,OAAO,EAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"titan-layout.stories.js","sourceRoot":"","sources":["../../../src/components/titan-layout/titan-layout.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM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SAAG,EAC1B,KAAC,WAAW,CAAC,OAAO,cAChB,KAAC,UAAU,cACP,KAAC,UAAU,CAAC,OAAO,cACf,KAAC,OAAO,OAAK,IAAI,GAAI,GACJ,GACZ,GACK,IACZ,CACjB,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.f834dab.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": "f834dab984458f0c3c0d7df80f64443bfee2f7f6"
|
|
46
46
|
}
|
|
@@ -157,6 +157,8 @@ export interface ProfileDropdownSectionPropsStrict {
|
|
|
157
157
|
id: string;
|
|
158
158
|
tooltip?: string;
|
|
159
159
|
className?: string;
|
|
160
|
+
tag?: CounterTagData;
|
|
161
|
+
counter?: CounterTagValue;
|
|
160
162
|
onClick?(e: MouseEvent): void;
|
|
161
163
|
}
|
|
162
164
|
|
|
@@ -167,7 +169,9 @@ export type ProfileDropdownSectionProps = Omit<ComponentPropsWithoutRef<'div'>,
|
|
|
167
169
|
export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
168
170
|
children,
|
|
169
171
|
className,
|
|
172
|
+
counter,
|
|
170
173
|
id,
|
|
174
|
+
tag,
|
|
171
175
|
text,
|
|
172
176
|
tooltip,
|
|
173
177
|
onClick,
|
|
@@ -181,6 +185,11 @@ export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
|
181
185
|
}
|
|
182
186
|
};
|
|
183
187
|
|
|
188
|
+
const tagElement = useMemo(
|
|
189
|
+
() => <CounterTag data={getCounterTag(counter, tag)} className={Styles.counter} />,
|
|
190
|
+
[counter, tag]
|
|
191
|
+
);
|
|
192
|
+
|
|
184
193
|
return withTooltip(
|
|
185
194
|
<div
|
|
186
195
|
className={classNames(Styles.dropdownSection, className, {
|
|
@@ -192,6 +201,7 @@ export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
|
192
201
|
{...rest}
|
|
193
202
|
>
|
|
194
203
|
{children}
|
|
204
|
+
{tagElement}
|
|
195
205
|
</div>,
|
|
196
206
|
tooltip,
|
|
197
207
|
'left'
|
|
@@ -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
|
});
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
background-color: @color-white;
|
|
12
12
|
color: @color-black;
|
|
13
13
|
box-sizing: border-box;
|
|
14
|
-
outline: 1px solid
|
|
14
|
+
outline: 1px solid @color-neutral-60;
|
|
15
15
|
|
|
16
16
|
& > * {
|
|
17
17
|
overflow-y: hidden;
|
|
@@ -90,29 +90,59 @@
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
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
|
+
|
|
93
119
|
// desktop
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
padding: 6px 6px;
|
|
100
|
-
}
|
|
120
|
+
.header-desktop {
|
|
121
|
+
height: var(--nav-offset-top);
|
|
122
|
+
.navigation-link {
|
|
123
|
+
margin: 6px 2px;
|
|
124
|
+
padding: 6px 6px;
|
|
101
125
|
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.he-top-center {
|
|
106
|
-
flex: 1;
|
|
107
|
-
margin-left: @spacing-2;
|
|
108
|
-
margin-right: @spacing-2;
|
|
109
|
-
max-width: 400px;
|
|
126
|
+
.navigation-item-counter {
|
|
127
|
+
min-width: 12px !important;
|
|
128
|
+
height: 12px !important;
|
|
110
129
|
}
|
|
111
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
|
+
}
|
|
112
141
|
}
|
|
142
|
+
|
|
113
143
|
// desktop wide
|
|
114
144
|
@media only screen and (min-width: 1200px) {
|
|
115
|
-
.header {
|
|
145
|
+
.header-desktop {
|
|
116
146
|
display: grid;
|
|
117
147
|
grid-template-columns: repeat(3, 1fr);
|
|
118
148
|
grid-template-rows: 48px;
|
|
@@ -129,34 +159,6 @@
|
|
|
129
159
|
}
|
|
130
160
|
}
|
|
131
161
|
|
|
132
|
-
// mobile
|
|
133
|
-
@media only screen and (max-width: 768px) {
|
|
134
|
-
.header {
|
|
135
|
-
padding: @spacing-2 @spacing-0;
|
|
136
|
-
height: var(--nav-offset-top);
|
|
137
|
-
--nav-top-content-height: 40px;
|
|
138
|
-
|
|
139
|
-
.navigation-link {
|
|
140
|
-
padding: 10px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.he-top-center {
|
|
144
|
-
max-width: unset;
|
|
145
|
-
flex: 1;
|
|
146
|
-
margin-left: @spacing-3;
|
|
147
|
-
margin-right: @spacing-3;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.he-top-left {
|
|
151
|
-
margin-left: @spacing-half;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.he-top-right {
|
|
155
|
-
margin-right: @spacing-half;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
162
|
.navigation-link {
|
|
161
163
|
// styles specific to extra nav links
|
|
162
164
|
color: @color-black;
|
|
@@ -189,12 +191,3 @@
|
|
|
189
191
|
right: -8px;
|
|
190
192
|
}
|
|
191
193
|
}
|
|
192
|
-
|
|
193
|
-
@media only screen and (min-width: 768px) {
|
|
194
|
-
.navigation-link {
|
|
195
|
-
.navigation-item-counter {
|
|
196
|
-
min-width: 12px !important;
|
|
197
|
-
height: 12px !important;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
@@ -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;
|
|
@@ -47,7 +47,11 @@ export const LayoutHeader: FC<LayoutHeaderProps> = ({
|
|
|
47
47
|
return (
|
|
48
48
|
<LayoutPlacementContext.Provider value="top">
|
|
49
49
|
<div
|
|
50
|
-
className={classNames(
|
|
50
|
+
className={classNames(
|
|
51
|
+
Styles.header,
|
|
52
|
+
isMobile ? Styles.headerMobile : Styles.headerDesktop,
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
51
55
|
{...rest}
|
|
52
56
|
data-cy="header-navigation"
|
|
53
57
|
>
|
|
@@ -25,8 +25,16 @@ export type {
|
|
|
25
25
|
ProfileDropdownLinkProps,
|
|
26
26
|
} from '../profile-dropdown/profile-dropdown';
|
|
27
27
|
|
|
28
|
-
const ExternalNavComponent: FC<NavLinkComponentProps> = ({
|
|
29
|
-
|
|
28
|
+
const ExternalNavComponent: FC<NavLinkComponentProps> = ({
|
|
29
|
+
children,
|
|
30
|
+
isActive,
|
|
31
|
+
to,
|
|
32
|
+
activeClassName,
|
|
33
|
+
...props
|
|
34
|
+
}) => (
|
|
35
|
+
<a {...props} href={to}>
|
|
36
|
+
{children}
|
|
37
|
+
</a>
|
|
30
38
|
);
|
|
31
39
|
|
|
32
40
|
const ProfileDropdownContent: FC<ProfileDropdownProps> = props => {
|
|
@@ -88,18 +96,25 @@ const ProfileDropdownDivider: FC = () => {
|
|
|
88
96
|
);
|
|
89
97
|
};
|
|
90
98
|
|
|
91
|
-
const getText = (
|
|
92
|
-
if (typeof
|
|
93
|
-
return
|
|
99
|
+
const getText = (children: any, text: any): string | undefined => {
|
|
100
|
+
if (typeof children === 'string') {
|
|
101
|
+
return children;
|
|
94
102
|
}
|
|
95
103
|
|
|
96
|
-
if (typeof
|
|
97
|
-
return
|
|
104
|
+
if (typeof text === 'string') {
|
|
105
|
+
return text;
|
|
98
106
|
}
|
|
99
107
|
|
|
100
108
|
return undefined;
|
|
101
109
|
};
|
|
102
110
|
|
|
111
|
+
const getTag = (
|
|
112
|
+
tag: ProfileDropdownLinkProps['tag'],
|
|
113
|
+
counter: ProfileDropdownLinkProps['counter']
|
|
114
|
+
): boolean => {
|
|
115
|
+
return !!tag?.value || !!counter;
|
|
116
|
+
};
|
|
117
|
+
|
|
103
118
|
const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = props => {
|
|
104
119
|
const { breakpoint } = useTitanLayoutContext();
|
|
105
120
|
return breakpoint.isMobile ? (
|
|
@@ -108,10 +123,19 @@ const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = props => {
|
|
|
108
123
|
<DesktopProfileDropdown.Section {...props} />
|
|
109
124
|
);
|
|
110
125
|
};
|
|
111
|
-
const MobileProfileDropdownSection: FC<ProfileDropdownSectionProps> =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
126
|
+
const MobileProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
127
|
+
children,
|
|
128
|
+
text,
|
|
129
|
+
tooltip,
|
|
130
|
+
title,
|
|
131
|
+
...props
|
|
132
|
+
}) => {
|
|
133
|
+
const sectionText = getText(children, text);
|
|
134
|
+
const { onNotificationsUpdate } = useNotificationsContext();
|
|
135
|
+
onNotificationsUpdate(props.id, getTag(props.tag, props.counter));
|
|
136
|
+
|
|
137
|
+
return sectionText ? (
|
|
138
|
+
<InternalSideNavigationGroupTrigger {...props} title={sectionText} />
|
|
115
139
|
) : null;
|
|
116
140
|
};
|
|
117
141
|
|
|
@@ -126,19 +150,22 @@ const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = props => {
|
|
|
126
150
|
const MobileProfileDropdownLink: FC<ProfileDropdownLinkProps & NavigationComponentProps> = ({
|
|
127
151
|
external,
|
|
128
152
|
to,
|
|
153
|
+
tooltip,
|
|
154
|
+
text,
|
|
155
|
+
children,
|
|
129
156
|
navigationComponent,
|
|
130
157
|
...props
|
|
131
158
|
}) => {
|
|
132
159
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
133
|
-
const
|
|
160
|
+
const linkText = getText(children, text);
|
|
134
161
|
const isExternalLink = external ?? to?.startsWith('http');
|
|
135
|
-
onNotificationsUpdate(props.id,
|
|
162
|
+
onNotificationsUpdate(props.id, getTag(props.tag, props.counter));
|
|
136
163
|
|
|
137
|
-
return
|
|
164
|
+
return linkText ? (
|
|
138
165
|
<InternalSideNavigationGroupLink
|
|
139
166
|
{...props}
|
|
140
167
|
to={to}
|
|
141
|
-
title={
|
|
168
|
+
title={linkText}
|
|
142
169
|
navigationComponent={isExternalLink ? ExternalNavComponent : navigationComponent}
|
|
143
170
|
/>
|
|
144
171
|
) : null;
|
|
@@ -64,5 +64,9 @@ export function TitanLayoutSidebarTrigger({
|
|
|
64
64
|
onClick={isMobile && !!onMobileClick ? onMobileClick : onClick}
|
|
65
65
|
/>
|
|
66
66
|
);
|
|
67
|
-
return wrapper && !isMobile
|
|
67
|
+
return wrapper && (!isMobile || !onMobileClick) ? (
|
|
68
|
+
<WrappedLink wrapper={wrapper}>{element}</WrappedLink>
|
|
69
|
+
) : (
|
|
70
|
+
element
|
|
71
|
+
);
|
|
68
72
|
}
|
|
@@ -53,15 +53,14 @@
|
|
|
53
53
|
|
|
54
54
|
.layout-legacy,
|
|
55
55
|
.layout-anvil2 {
|
|
56
|
-
overflow-x: auto;
|
|
57
56
|
.top-placeholder {
|
|
58
57
|
height: var(--nav-offset-top);
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
.layout {
|
|
63
|
-
--nav-offset-top:
|
|
64
|
-
--nav-offset-left:
|
|
62
|
+
--nav-offset-top: 0px;
|
|
63
|
+
--nav-offset-left: 0px;
|
|
65
64
|
|
|
66
65
|
&.layout-desktop.layout-top {
|
|
67
66
|
--nav-offset-top: 48px;
|
|
@@ -147,6 +147,10 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
|
|
|
147
147
|
const [mobileDrawerOpened, setMobileDrawerOpened] = useState(false);
|
|
148
148
|
const { content, logo } = useLayoutChildren(children);
|
|
149
149
|
const { hasNotifications, NotificationsContextProvider } = useNotificationsState();
|
|
150
|
+
const [anvil2Styles, setAnvil2Styles] = useState<object>({});
|
|
151
|
+
const updateIndicatorsHeight = useCallback((offset: number) => {
|
|
152
|
+
setAnvil2Styles({ '--offset': `calc(var(--nav-offset-top) + ${offset}px)` });
|
|
153
|
+
}, []);
|
|
150
154
|
|
|
151
155
|
const isMobile = breakpoint.isMobile;
|
|
152
156
|
const hasSideBar = !contentOnly && (!!navigationMainItems?.length || !!sideTop?.length);
|
|
@@ -203,6 +207,30 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
|
|
|
203
207
|
}
|
|
204
208
|
}, [navigationMainItems]);
|
|
205
209
|
|
|
210
|
+
const limitContentWidth = useMemo(() => {
|
|
211
|
+
if (variant.isAnvil2 || !minContentWidth) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (breakpoint.width < minContentWidth) {
|
|
216
|
+
return minContentWidth;
|
|
217
|
+
}
|
|
218
|
+
}, [variant, minContentWidth, breakpoint.width]);
|
|
219
|
+
|
|
220
|
+
const contentStyles = useMemo(() => {
|
|
221
|
+
if (variant.isAnvil2) {
|
|
222
|
+
return anvil2Styles;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (variant.isLegacy && limitContentWidth) {
|
|
226
|
+
return {
|
|
227
|
+
display: 'flex',
|
|
228
|
+
flexDirection: 'column',
|
|
229
|
+
minHeight: '100vh',
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}, [variant, anvil2Styles, limitContentWidth]);
|
|
233
|
+
|
|
206
234
|
const layoutClass = variant.isLegacy
|
|
207
235
|
? Styles.layoutLegacy
|
|
208
236
|
: variant.isAnvil1
|
|
@@ -224,6 +252,7 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
|
|
|
224
252
|
},
|
|
225
253
|
layoutClass
|
|
226
254
|
)}
|
|
255
|
+
style={contentStyles}
|
|
227
256
|
>
|
|
228
257
|
{variant.isSequent && <div className={Styles.topPlaceholder} />}
|
|
229
258
|
{hasTopBar && (
|
|
@@ -281,14 +310,23 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
|
|
|
281
310
|
/>
|
|
282
311
|
</NotificationsContextProvider>
|
|
283
312
|
)}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
{
|
|
291
|
-
|
|
313
|
+
|
|
314
|
+
{variant.isAnvil1 ? (
|
|
315
|
+
<LayoutContentAnvil1 header={header} minWidth={limitContentWidth}>
|
|
316
|
+
{content}
|
|
317
|
+
</LayoutContentAnvil1>
|
|
318
|
+
) : variant.isLegacy ? (
|
|
319
|
+
<LayoutContentLegacy header={header} minWidth={limitContentWidth}>
|
|
320
|
+
{content}
|
|
321
|
+
</LayoutContentLegacy>
|
|
322
|
+
) : (
|
|
323
|
+
<LayoutContentAnvil2
|
|
324
|
+
header={header}
|
|
325
|
+
onHeaderHeightChange={updateIndicatorsHeight}
|
|
326
|
+
>
|
|
327
|
+
{content}
|
|
328
|
+
</LayoutContentAnvil2>
|
|
329
|
+
)}
|
|
292
330
|
</div>
|
|
293
331
|
</LayoutPlacementContext.Provider>
|
|
294
332
|
</LayoutContext.Provider>
|
|
@@ -329,57 +367,92 @@ const TitanLayoutHeaderObserved: FC<{
|
|
|
329
367
|
</div>
|
|
330
368
|
);
|
|
331
369
|
};
|
|
370
|
+
const TitanLayoutHeader: FC<{ children: ReactNode }> = ({ children }) => {
|
|
371
|
+
return (
|
|
372
|
+
<div className={Styles.contentHeader} data-cy="layout-content-header">
|
|
373
|
+
{children}
|
|
374
|
+
</div>
|
|
375
|
+
);
|
|
376
|
+
};
|
|
332
377
|
|
|
333
378
|
export interface TitanLayoutContentProps {
|
|
334
379
|
children: ReactNode;
|
|
335
380
|
}
|
|
336
381
|
const TitanLayoutContent: FC<TitanLayoutContentProps> = ({ children }) => children;
|
|
337
382
|
|
|
338
|
-
const
|
|
383
|
+
const LayoutContentAnvil2: FC<{
|
|
339
384
|
children: ReactNode;
|
|
340
385
|
header?: ReactNode;
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
386
|
+
onHeaderHeightChange?: (height: number) => void;
|
|
387
|
+
}> = ({ children, header, onHeaderHeightChange }) => {
|
|
388
|
+
return (
|
|
389
|
+
<Fragment>
|
|
390
|
+
<TitanLayoutHeaderObserved heightChange={onHeaderHeightChange}>
|
|
391
|
+
{header}
|
|
392
|
+
</TitanLayoutHeaderObserved>
|
|
393
|
+
{children}
|
|
394
|
+
</Fragment>
|
|
395
|
+
);
|
|
396
|
+
};
|
|
349
397
|
|
|
350
|
-
|
|
398
|
+
const LayoutContentAnvil1: FC<{
|
|
399
|
+
children: ReactNode;
|
|
400
|
+
header?: ReactNode;
|
|
401
|
+
minWidth?: number;
|
|
402
|
+
}> = ({ children, header, minWidth }) => {
|
|
403
|
+
const innerContentStyles: CSSProperties = useMemo(
|
|
351
404
|
() => ({
|
|
352
405
|
...(minWidth ? { minWidth: `${minWidth}px` } : {}),
|
|
353
|
-
...(anvil2 ? anvil2Styles : {}),
|
|
354
406
|
}),
|
|
355
|
-
[
|
|
407
|
+
[minWidth]
|
|
356
408
|
);
|
|
357
409
|
|
|
358
410
|
return (
|
|
359
411
|
<Fragment>
|
|
360
|
-
{
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
{anvil1 ? (
|
|
372
|
-
<div className="position-relative d-f flex-grow-1 flex-basis-0 of-hidden">
|
|
373
|
-
{children}
|
|
374
|
-
</div>
|
|
375
|
-
) : (
|
|
376
|
-
children
|
|
377
|
-
)}
|
|
412
|
+
<TitanLayoutHeader>{header}</TitanLayoutHeader>
|
|
413
|
+
<div
|
|
414
|
+
className={classNames(Styles.content, { 'of-x-auto': !!minWidth })}
|
|
415
|
+
data-cy="layout-content"
|
|
416
|
+
>
|
|
417
|
+
<div
|
|
418
|
+
className="position-relative d-f flex-grow-1 flex-basis-0 of-hidden"
|
|
419
|
+
style={innerContentStyles}
|
|
420
|
+
>
|
|
421
|
+
{children}
|
|
422
|
+
</div>
|
|
378
423
|
</div>
|
|
379
424
|
</Fragment>
|
|
380
425
|
);
|
|
381
426
|
};
|
|
382
427
|
|
|
428
|
+
const LayoutContentLegacy: FC<{
|
|
429
|
+
children: ReactNode;
|
|
430
|
+
header?: ReactNode;
|
|
431
|
+
minWidth: number | undefined;
|
|
432
|
+
}> = ({ children, header, minWidth }) => {
|
|
433
|
+
const innerContentStyles: CSSProperties = useMemo(
|
|
434
|
+
() => ({
|
|
435
|
+
position: 'relative',
|
|
436
|
+
minWidth: `${minWidth}px`,
|
|
437
|
+
}),
|
|
438
|
+
[minWidth]
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
<Fragment>
|
|
443
|
+
<TitanLayoutHeader>{header}</TitanLayoutHeader>
|
|
444
|
+
|
|
445
|
+
{minWidth ? (
|
|
446
|
+
<div className="of-x-auto flex-basis-0 flex-grow-1">
|
|
447
|
+
<div style={innerContentStyles}>{children}</div>
|
|
448
|
+
</div>
|
|
449
|
+
) : (
|
|
450
|
+
children
|
|
451
|
+
)}
|
|
452
|
+
</Fragment>
|
|
453
|
+
);
|
|
454
|
+
};
|
|
455
|
+
|
|
383
456
|
export const TitanLayout = Object.assign(TitanLayoutComponent, {
|
|
384
457
|
Content: TitanLayoutContent,
|
|
385
458
|
Logo: TitanLayoutLogo,
|
|
@@ -4,6 +4,7 @@ import { useMemo } from 'react';
|
|
|
4
4
|
export interface TitanBreakpoint {
|
|
5
5
|
name: BreakpointReturnProps['name'];
|
|
6
6
|
isMobile: boolean;
|
|
7
|
+
width: number;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export const useTitanBreakpoint = (): TitanBreakpoint => {
|
|
@@ -12,7 +13,8 @@ export const useTitanBreakpoint = (): TitanBreakpoint => {
|
|
|
12
13
|
return useMemo(
|
|
13
14
|
() => ({
|
|
14
15
|
name: breakpoint?.name ?? 'xl',
|
|
15
|
-
isMobile: breakpoint ? breakpoint.innerWidth
|
|
16
|
+
isMobile: breakpoint ? breakpoint.innerWidth < 768 : false,
|
|
17
|
+
width: breakpoint?.innerWidth ?? 0,
|
|
16
18
|
}),
|
|
17
19
|
[breakpoint]
|
|
18
20
|
);
|