@servicetitan/navigation 11.0.0-canary.237.4d902dc.0 → 11.0.0-canary.237.5f3f02d.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/header-navigation/header-navigation-stacked.stories.js +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny.stories.js +2 -2
- package/dist/components/left-navigation/header-navigation-tiny.stories.js.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 +12 -7
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +10 -7
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +20 -6
- 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-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links.js +1 -1
- package/dist/components/titan-layout/layout-header-links.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 +61 -21
- 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 +39 -11
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-profile.stories.d.ts.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 +12 -5
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts +2 -1
- 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 +29 -21
- 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 +10 -6
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +104 -21
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.module.less +74 -19
- package/dist/components/titan-layout/titan-layout.stories.d.ts +15 -11
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.stories.js +35 -14
- 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/header-navigation/header-navigation-stacked.stories.tsx +1 -1
- package/src/components/header-navigation/header-navigation.stories.tsx +1 -1
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +2 -2
- package/src/components/logo/logo-titan-text.tsx +1 -1
- package/src/components/profile-dropdown/profile-dropdown.module.less +20 -6
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +2 -0
- package/src/components/profile-dropdown/profile-dropdown.tsx +50 -15
- package/src/components/titan-layout/layout-context.tsx +1 -1
- package/src/components/titan-layout/layout-header-links.tsx +2 -1
- package/src/components/titan-layout/layout-header.module.less +61 -21
- package/src/components/titan-layout/layout-header.module.less.d.ts +2 -0
- package/src/components/titan-layout/layout-header.tsx +17 -6
- package/src/components/titan-layout/layout-logo.tsx +13 -6
- package/src/components/titan-layout/layout-profile.stories.tsx +10 -1
- package/src/components/titan-layout/layout-profile.tsx +92 -28
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +18 -5
- package/src/components/titan-layout/layout-sidebar-links.tsx +21 -5
- package/src/components/titan-layout/layout-sidebar.module.less +29 -21
- package/src/components/titan-layout/layout-sidebar.module.less.d.ts +1 -2
- package/src/components/titan-layout/layout-sidebar.tsx +15 -9
- package/src/components/titan-layout/notifications-context.tsx +44 -0
- package/src/components/titan-layout/titan-layout.module.less +74 -19
- package/src/components/titan-layout/titan-layout.module.less.d.ts +5 -0
- package/src/components/titan-layout/titan-layout.stories.tsx +171 -19
- package/src/components/titan-layout/titan-layout.tsx +244 -74
- package/src/test/data.tsx +2 -3
- package/src/utils/use-breakpoint.ts +3 -1
|
@@ -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.5f3f02d.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": "5f3f02dc96a43a51bcd8e0b05988f4b17e7e3639"
|
|
46
46
|
}
|
|
@@ -130,7 +130,7 @@ export const WithAllMonolithData = () => (
|
|
|
130
130
|
Task Management
|
|
131
131
|
</ProfileDropdown.Link>
|
|
132
132
|
<ProfileDropdown.Divider />
|
|
133
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
133
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
134
134
|
Sign Out{' '}
|
|
135
135
|
<span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
136
136
|
</ProfileDropdown.Link>
|
|
@@ -154,7 +154,7 @@ export const WithAllMonolithData = () => (
|
|
|
154
154
|
Task Management
|
|
155
155
|
</ProfileDropdown.Link>
|
|
156
156
|
<ProfileDropdown.Divider />
|
|
157
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
157
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
158
158
|
Sign Out <span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
159
159
|
</ProfileDropdown.Link>
|
|
160
160
|
<ProfileDropdown.Section id="userid" className="c-neutral-100 fs-1">
|
|
@@ -93,7 +93,7 @@ export const WithAllMonolithData = () => (
|
|
|
93
93
|
Task Management
|
|
94
94
|
</ProfileDropdown.Link>
|
|
95
95
|
<ProfileDropdown.Divider />
|
|
96
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
96
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
97
97
|
Sign Out{' '}
|
|
98
98
|
<span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
99
99
|
</ProfileDropdown.Link>
|
|
@@ -162,7 +162,7 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
162
162
|
Task Management
|
|
163
163
|
</ProfileDropdown.Link>
|
|
164
164
|
<ProfileDropdown.Divider />
|
|
165
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
165
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
166
166
|
Sign Out{' '}
|
|
167
167
|
<span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
168
168
|
</ProfileDropdown.Link>
|
|
@@ -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;
|
|
@@ -123,6 +123,11 @@
|
|
|
123
123
|
|
|
124
124
|
.dropdown-section {
|
|
125
125
|
padding: @spacing-1 @spacing-2;
|
|
126
|
+
position: relative;
|
|
127
|
+
|
|
128
|
+
&.dropdown-section-with-counter {
|
|
129
|
+
padding-right: @spacing-3;
|
|
130
|
+
}
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
.dropdown-link {
|
|
@@ -136,13 +141,22 @@
|
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
143
|
|
|
139
|
-
.counter {
|
|
140
|
-
color: @color-white;
|
|
141
|
-
font-size: @typescale-0;
|
|
142
|
-
font-weight: @font-weight-semibold;
|
|
144
|
+
.counter-wrapper {
|
|
143
145
|
position: absolute;
|
|
144
|
-
top:
|
|
145
|
-
|
|
146
|
+
top: 0;
|
|
147
|
+
bottom: 0;
|
|
148
|
+
right: @spacing-1;
|
|
149
|
+
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
|
|
153
|
+
.counter {
|
|
154
|
+
color: @color-white;
|
|
155
|
+
font-size: @typescale-0;
|
|
156
|
+
font-weight: @font-weight-semibold;
|
|
157
|
+
min-width: 12px !important;
|
|
158
|
+
min-height: 12px !important;
|
|
159
|
+
}
|
|
146
160
|
}
|
|
147
161
|
}
|
|
148
162
|
|
|
@@ -4,12 +4,14 @@ export const badge: string;
|
|
|
4
4
|
export const badgeNoContent: string;
|
|
5
5
|
export const badgeWithContent: string;
|
|
6
6
|
export const counter: string;
|
|
7
|
+
export const counterWrapper: string;
|
|
7
8
|
export const dropdown: string;
|
|
8
9
|
export const dropdownContent: string;
|
|
9
10
|
export const dropdownContentBottomLeft: string;
|
|
10
11
|
export const dropdownContentWrapper: string;
|
|
11
12
|
export const dropdownLink: string;
|
|
12
13
|
export const dropdownSection: string;
|
|
14
|
+
export const dropdownSectionWithCounter: string;
|
|
13
15
|
export const expandIcon: string;
|
|
14
16
|
export const hint: string;
|
|
15
17
|
export const hintContent: string;
|
|
@@ -6,6 +6,7 @@ import SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_accoun
|
|
|
6
6
|
import { BodyText, Popover, PopoverPropsStrict } from '@servicetitan/design-system';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import {
|
|
9
|
+
ComponentPropsWithoutRef,
|
|
9
10
|
FC,
|
|
10
11
|
HTMLAttributeAnchorTarget,
|
|
11
12
|
MouseEvent,
|
|
@@ -147,22 +148,42 @@ const ProfileDropdownTrigger: FC<ProfileDropdownTriggerProps> = ({
|
|
|
147
148
|
);
|
|
148
149
|
};
|
|
149
150
|
|
|
151
|
+
const useTag = (counter?: CounterTagValue, tag?: CounterTagData) =>
|
|
152
|
+
useMemo(() => {
|
|
153
|
+
const data = getCounterTag(counter, tag);
|
|
154
|
+
|
|
155
|
+
return data ? (
|
|
156
|
+
<div className={Styles.counterWrapper}>
|
|
157
|
+
<CounterTag className={Styles.counter} data={data} />
|
|
158
|
+
</div>
|
|
159
|
+
) : undefined;
|
|
160
|
+
}, [counter, tag]);
|
|
161
|
+
|
|
162
|
+
export type ProfileItemContent =
|
|
163
|
+
| { children: string; text?: string }
|
|
164
|
+
| { children: ReactNode; text: string };
|
|
165
|
+
|
|
150
166
|
export interface ProfileDropdownSectionPropsStrict {
|
|
151
167
|
children: ReactNode;
|
|
152
168
|
id: string;
|
|
153
169
|
tooltip?: string;
|
|
154
170
|
className?: string;
|
|
171
|
+
tag?: CounterTagData;
|
|
172
|
+
counter?: CounterTagValue;
|
|
155
173
|
onClick?(e: MouseEvent): void;
|
|
156
174
|
}
|
|
157
175
|
|
|
158
|
-
export
|
|
159
|
-
|
|
160
|
-
|
|
176
|
+
export type ProfileDropdownSectionProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> &
|
|
177
|
+
ProfileDropdownSectionPropsStrict &
|
|
178
|
+
ProfileItemContent;
|
|
161
179
|
|
|
162
180
|
export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
163
181
|
children,
|
|
164
182
|
className,
|
|
183
|
+
counter,
|
|
165
184
|
id,
|
|
185
|
+
tag,
|
|
186
|
+
text,
|
|
166
187
|
tooltip,
|
|
167
188
|
onClick,
|
|
168
189
|
...rest
|
|
@@ -175,17 +196,23 @@ export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
|
175
196
|
}
|
|
176
197
|
};
|
|
177
198
|
|
|
199
|
+
const tagElement = useTag(counter, tag);
|
|
200
|
+
|
|
178
201
|
return withTooltip(
|
|
179
202
|
<div
|
|
180
|
-
className={classNames(
|
|
181
|
-
|
|
182
|
-
|
|
203
|
+
className={classNames(
|
|
204
|
+
Styles.dropdownSection,
|
|
205
|
+
tagElement && Styles.dropdownSectionWithCounter,
|
|
206
|
+
!!onClick && Styles.dropdownLink,
|
|
207
|
+
className
|
|
208
|
+
)}
|
|
183
209
|
onClick={clickHandler}
|
|
184
210
|
data-cy={`profile-dropdown-section-${id}`}
|
|
185
211
|
data-pendo={`profile-dropdown-section-${id}`}
|
|
186
212
|
{...rest}
|
|
187
213
|
>
|
|
188
214
|
{children}
|
|
215
|
+
{tagElement}
|
|
189
216
|
</div>,
|
|
190
217
|
tooltip,
|
|
191
218
|
'left'
|
|
@@ -206,9 +233,9 @@ export interface ProfileDropdownLinkPropsStrict {
|
|
|
206
233
|
counter?: CounterTagValue;
|
|
207
234
|
}
|
|
208
235
|
|
|
209
|
-
export
|
|
210
|
-
|
|
211
|
-
|
|
236
|
+
export type ProfileDropdownLinkProps = Omit<ComponentPropsWithoutRef<'a'>, 'children'> &
|
|
237
|
+
ProfileDropdownLinkPropsStrict &
|
|
238
|
+
ProfileItemContent;
|
|
212
239
|
|
|
213
240
|
export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
214
241
|
children,
|
|
@@ -218,6 +245,7 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
218
245
|
counter,
|
|
219
246
|
tag,
|
|
220
247
|
target,
|
|
248
|
+
text,
|
|
221
249
|
to,
|
|
222
250
|
tooltip,
|
|
223
251
|
onClick,
|
|
@@ -227,15 +255,17 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
227
255
|
|
|
228
256
|
const isExternalLink = external ?? to?.startsWith('http');
|
|
229
257
|
|
|
230
|
-
const tagElement =
|
|
231
|
-
() => <CounterTag data={getCounterTag(counter, tag)} className={Styles.counter} />,
|
|
232
|
-
[counter, tag]
|
|
233
|
-
);
|
|
258
|
+
const tagElement = useTag(counter, tag);
|
|
234
259
|
|
|
235
260
|
return withTooltip(
|
|
236
261
|
isExternalLink ? (
|
|
237
262
|
<a
|
|
238
|
-
className={classNames(
|
|
263
|
+
className={classNames(
|
|
264
|
+
Styles.dropdownSection,
|
|
265
|
+
tagElement && Styles.dropdownSectionWithCounter,
|
|
266
|
+
Styles.dropdownLink,
|
|
267
|
+
className
|
|
268
|
+
)}
|
|
239
269
|
href={to}
|
|
240
270
|
target={target}
|
|
241
271
|
data-cy={`profile-dropdown-link-${id}`}
|
|
@@ -247,7 +277,12 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
247
277
|
</a>
|
|
248
278
|
) : (
|
|
249
279
|
<NavigationComponent
|
|
250
|
-
className={classNames(
|
|
280
|
+
className={classNames(
|
|
281
|
+
Styles.dropdownSection,
|
|
282
|
+
Styles.dropdownLink,
|
|
283
|
+
{ [Styles.dropdownSectionWithCounter]: !!tagElement },
|
|
284
|
+
className
|
|
285
|
+
)}
|
|
251
286
|
target={target}
|
|
252
287
|
to={to}
|
|
253
288
|
data-cy={`profile-dropdown-link-${id}`}
|
|
@@ -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
|
});
|
|
@@ -134,7 +134,8 @@ export const LayoutHeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = (
|
|
|
134
134
|
>
|
|
135
135
|
<HeaderNavigationItemContent
|
|
136
136
|
tag={getCounterTag(counter, tag)}
|
|
137
|
-
icon={
|
|
137
|
+
icon={icon}
|
|
138
|
+
iconActive={iconActive}
|
|
138
139
|
label={label}
|
|
139
140
|
labelClassName={labelClassName}
|
|
140
141
|
/>
|
|
@@ -4,28 +4,29 @@
|
|
|
4
4
|
@size-links-tiny: 24px;
|
|
5
5
|
|
|
6
6
|
.header {
|
|
7
|
-
|
|
7
|
+
--nav-top-content-height: 32px;
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-between;
|
|
8
10
|
|
|
9
11
|
background-color: @color-white;
|
|
10
12
|
color: @color-black;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
outline: 1px solid @color-neutral-60;
|
|
11
15
|
|
|
12
16
|
& > * {
|
|
13
17
|
overflow-y: hidden;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
.he-top-left {
|
|
17
|
-
grid-column: span 1;
|
|
18
21
|
display: flex;
|
|
19
22
|
align-items: center;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
.he-top-center {
|
|
23
|
-
|
|
26
|
+
overflow: hidden;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
.he-top-right {
|
|
27
|
-
grid-column: span 1;
|
|
28
|
-
|
|
29
30
|
& > * {
|
|
30
31
|
color: @color-black;
|
|
31
32
|
}
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
&.navigation-item-icon-state.navigation-item-active {
|
|
65
|
-
.navigation-icon:not(.navigation-icon-active) {
|
|
66
|
+
.navigation-icon[data-anv][data-anv]:not(.navigation-icon-active) {
|
|
66
67
|
display: none;
|
|
67
68
|
}
|
|
68
69
|
|
|
@@ -89,33 +90,71 @@
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
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
|
+
|
|
92
119
|
// desktop
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
120
|
+
.header-desktop {
|
|
121
|
+
height: var(--nav-offset-top);
|
|
122
|
+
.navigation-link {
|
|
123
|
+
margin: 6px 2px;
|
|
124
|
+
padding: 6px 6px;
|
|
97
125
|
|
|
98
|
-
.navigation-
|
|
99
|
-
|
|
100
|
-
|
|
126
|
+
.navigation-item-counter {
|
|
127
|
+
min-width: 12px !important;
|
|
128
|
+
height: 12px !important;
|
|
101
129
|
}
|
|
102
130
|
}
|
|
103
131
|
|
|
104
132
|
.he-top-left {
|
|
105
133
|
padding-left: @spacing-1;
|
|
106
134
|
}
|
|
135
|
+
.he-top-center {
|
|
136
|
+
flex: 1;
|
|
137
|
+
margin-left: @spacing-2;
|
|
138
|
+
margin-right: @spacing-2;
|
|
139
|
+
max-width: 400px;
|
|
140
|
+
}
|
|
107
141
|
}
|
|
108
142
|
|
|
109
|
-
//
|
|
110
|
-
@media only screen and (
|
|
111
|
-
.header {
|
|
143
|
+
// desktop wide
|
|
144
|
+
@media only screen and (min-width: 1200px) {
|
|
145
|
+
.header-desktop {
|
|
146
|
+
display: grid;
|
|
112
147
|
grid-template-columns: repeat(3, 1fr);
|
|
113
|
-
grid-template-rows:
|
|
148
|
+
grid-template-rows: 48px;
|
|
114
149
|
|
|
115
|
-
|
|
150
|
+
.he-top-left,
|
|
151
|
+
.he-top-center,
|
|
152
|
+
.he-top-right {
|
|
153
|
+
grid-column: span 1;
|
|
154
|
+
}
|
|
116
155
|
|
|
117
|
-
.
|
|
118
|
-
|
|
156
|
+
.he-top-center {
|
|
157
|
+
max-width: unset;
|
|
119
158
|
}
|
|
120
159
|
}
|
|
121
160
|
}
|
|
@@ -133,7 +172,8 @@
|
|
|
133
172
|
color: @color-white;
|
|
134
173
|
font-weight: @font-weight-semibold;
|
|
135
174
|
font-size: 8px !important;
|
|
136
|
-
min-width:
|
|
175
|
+
min-width: 16px !important;
|
|
176
|
+
height: 16px !important;
|
|
137
177
|
position: absolute;
|
|
138
178
|
top: 4px;
|
|
139
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,12 +64,17 @@ 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}
|
|
64
71
|
</div>
|
|
65
72
|
<div
|
|
66
|
-
className={classNames(
|
|
73
|
+
className={classNames(
|
|
74
|
+
Styles.heTopCenter,
|
|
75
|
+
'd-f align-items-center justify-content-center',
|
|
76
|
+
centerClassName
|
|
77
|
+
)}
|
|
67
78
|
data-cy="navigation-center"
|
|
68
79
|
>
|
|
69
80
|
{center}
|
|
@@ -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')}>
|
|
@@ -33,5 +33,14 @@ export const ProfileDefault = withTitanLayout(
|
|
|
33
33
|
third link
|
|
34
34
|
</ProfileDropdown.Link>
|
|
35
35
|
<ProfileDropdown.Divider />
|
|
36
|
+
<ProfileDropdown.Section
|
|
37
|
+
id="forth"
|
|
38
|
+
onClick={() => alert('forth click')}
|
|
39
|
+
text="Sign Out user"
|
|
40
|
+
>
|
|
41
|
+
Sign Out
|
|
42
|
+
<span className="c-neutral-60 m-l-1">user</span>
|
|
43
|
+
</ProfileDropdown.Section>
|
|
44
|
+
<ProfileDropdown.Divider />
|
|
36
45
|
</ProfileDropdown>
|
|
37
46
|
);
|