@servicetitan/navigation 11.0.0-canary.237.fef17f5.0 → 11.0.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 +56 -33
- 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 +10 -3
- 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 +44 -20
- package/dist/components/titan-layout/titan-layout.stories.d.ts +4 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.stories.js +15 -7
- 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 +56 -33
- 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 +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 +16 -3
- 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 +44 -20
- package/src/components/titan-layout/titan-layout.module.less.d.ts +2 -1
- package/src/components/titan-layout/titan-layout.stories.tsx +118 -6
- package/src/components/titan-layout/titan-layout.tsx +196 -87
- package/src/test/data.tsx +2 -3
- package/src/utils/use-breakpoint.ts +3 -1
|
@@ -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 (
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
InternalSideNavigationLink,
|
|
7
7
|
InternalSideNavigationTrigger,
|
|
8
8
|
} from './layout-sidebar-links-internal';
|
|
9
|
+
import { useNotificationsContext } from './notifications-context';
|
|
9
10
|
|
|
10
11
|
const WrappedLink: FC<{
|
|
11
12
|
children: ReactElement<any>;
|
|
@@ -21,6 +22,10 @@ export function TitanLayoutSidebarLink({ wrapper, ...props }: TitanLayoutSidebar
|
|
|
21
22
|
NavigationComponent,
|
|
22
23
|
breakpoint: { isMobile },
|
|
23
24
|
} = useTitanLayoutContext();
|
|
25
|
+
const { onNotificationsUpdate } = useNotificationsContext();
|
|
26
|
+
const tag = getCounterTag(props.counter, props.tag);
|
|
27
|
+
|
|
28
|
+
onNotificationsUpdate(props.id, !!tag);
|
|
24
29
|
|
|
25
30
|
const element = (
|
|
26
31
|
<InternalSideNavigationLink
|
|
@@ -28,7 +33,7 @@ export function TitanLayoutSidebarLink({ wrapper, ...props }: TitanLayoutSidebar
|
|
|
28
33
|
navigationComponent={NavigationComponent}
|
|
29
34
|
submenuExpanded={undefined}
|
|
30
35
|
dataPrefix="navigation-link"
|
|
31
|
-
tag={
|
|
36
|
+
tag={tag}
|
|
32
37
|
/>
|
|
33
38
|
);
|
|
34
39
|
|
|
@@ -45,15 +50,23 @@ export function TitanLayoutSidebarTrigger({
|
|
|
45
50
|
const {
|
|
46
51
|
breakpoint: { isMobile },
|
|
47
52
|
} = useTitanLayoutContext();
|
|
53
|
+
const { onNotificationsUpdate } = useNotificationsContext();
|
|
54
|
+
const tag = getCounterTag(props.counter, props.tag);
|
|
55
|
+
|
|
56
|
+
onNotificationsUpdate(props.id, !!tag);
|
|
48
57
|
|
|
49
58
|
const element = (
|
|
50
59
|
<InternalSideNavigationTrigger
|
|
51
60
|
{...props}
|
|
52
61
|
submenuExpanded={undefined}
|
|
53
62
|
dataPrefix="navigation-trigger"
|
|
54
|
-
tag={
|
|
63
|
+
tag={tag}
|
|
55
64
|
onClick={isMobile && !!onMobileClick ? onMobileClick : onClick}
|
|
56
65
|
/>
|
|
57
66
|
);
|
|
58
|
-
return wrapper && !isMobile
|
|
67
|
+
return wrapper && (!isMobile || !onMobileClick) ? (
|
|
68
|
+
<WrappedLink wrapper={wrapper}>{element}</WrappedLink>
|
|
69
|
+
) : (
|
|
70
|
+
element
|
|
71
|
+
);
|
|
59
72
|
}
|
|
@@ -17,15 +17,20 @@
|
|
|
17
17
|
|
|
18
18
|
// mobile version
|
|
19
19
|
.nav-drawer {
|
|
20
|
-
display: none;
|
|
20
|
+
// display: none;
|
|
21
21
|
position: fixed;
|
|
22
22
|
max-width: 400px;
|
|
23
23
|
width: 0;
|
|
24
|
+
height: 100vh;
|
|
24
25
|
top: 0;
|
|
25
|
-
|
|
26
|
-
left: 0;
|
|
26
|
+
left: -100vh;
|
|
27
27
|
z-index: 991;
|
|
28
28
|
|
|
29
|
+
-webkit-transition: width 200ms ease-in-out;
|
|
30
|
+
-moz-transition: width 200ms ease-in-out;
|
|
31
|
+
-o-transition: width 200ms ease-in-out;
|
|
32
|
+
transition: width 200ms ease-in-out;
|
|
33
|
+
|
|
29
34
|
.nav-main {
|
|
30
35
|
padding-left: @spacing-2;
|
|
31
36
|
padding-right: @spacing-2;
|
|
@@ -39,6 +44,7 @@
|
|
|
39
44
|
padding-top: @spacing-2;
|
|
40
45
|
padding-left: @spacing-2;
|
|
41
46
|
padding-right: @spacing-2;
|
|
47
|
+
cursor: pointer;
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
|
|
@@ -61,10 +67,21 @@
|
|
|
61
67
|
}
|
|
62
68
|
}
|
|
63
69
|
|
|
70
|
+
.nav-drawer-backdrop {
|
|
71
|
+
position: fixed;
|
|
72
|
+
height: 100vh;
|
|
73
|
+
width: 100vw;
|
|
74
|
+
top: 0;
|
|
75
|
+
left: 0;
|
|
76
|
+
z-index: 991;
|
|
77
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
78
|
+
}
|
|
79
|
+
|
|
64
80
|
// mobile version opened
|
|
65
81
|
.nav-drawer-opened {
|
|
66
82
|
display: flex;
|
|
67
83
|
width: 90vw;
|
|
84
|
+
left: 0;
|
|
68
85
|
}
|
|
69
86
|
|
|
70
87
|
@media only screen and (min-width: 361px) {
|
|
@@ -142,6 +159,11 @@
|
|
|
142
159
|
.nav-wide {
|
|
143
160
|
width: var(--nav-offset-left);
|
|
144
161
|
|
|
162
|
+
.nav-item {
|
|
163
|
+
margin-left: @spacing-1;
|
|
164
|
+
margin-right: @spacing-1;
|
|
165
|
+
}
|
|
166
|
+
|
|
145
167
|
.toggle {
|
|
146
168
|
.toggle-content {
|
|
147
169
|
margin: @spacing-2;
|
|
@@ -171,8 +193,6 @@
|
|
|
171
193
|
.nav-wide {
|
|
172
194
|
.nav-item {
|
|
173
195
|
flex-direction: row;
|
|
174
|
-
margin-left: @spacing-1;
|
|
175
|
-
margin-right: @spacing-1;
|
|
176
196
|
|
|
177
197
|
.nav-item-icon-wrapper {
|
|
178
198
|
flex: 1;
|
|
@@ -5,6 +5,7 @@ export const navBottom: string;
|
|
|
5
5
|
export const navClose: string;
|
|
6
6
|
export const navCloseWrapper: string;
|
|
7
7
|
export const navDrawer: string;
|
|
8
|
+
export const navDrawerBackdrop: string;
|
|
8
9
|
export const navDrawerOpened: string;
|
|
9
10
|
export const navFooter: string;
|
|
10
11
|
export const navGroupItem: string;
|
|
@@ -33,9 +33,11 @@ export interface LayoutSidebarProps {
|
|
|
33
33
|
mainItems?: NavigationItemData[];
|
|
34
34
|
barExpanded: boolean;
|
|
35
35
|
submenuExpanded: string | undefined;
|
|
36
|
+
drawerOpened: boolean;
|
|
36
37
|
mobile: boolean;
|
|
37
38
|
navigationComponent: FC<NavLinkComponentProps>;
|
|
38
39
|
onBarExpandChange(expanded: boolean): void;
|
|
40
|
+
onDrawerOpenChange(expanded: boolean): void;
|
|
39
41
|
onSubmenuExpandChange(id: string, expanded: boolean): void;
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -44,29 +46,36 @@ export const LayoutSidebar: FC<LayoutSidebarProps> = ({
|
|
|
44
46
|
mobile,
|
|
45
47
|
barExpanded,
|
|
46
48
|
submenuExpanded,
|
|
49
|
+
drawerOpened,
|
|
47
50
|
onBarExpandChange,
|
|
48
51
|
onSubmenuExpandChange,
|
|
52
|
+
onDrawerOpenChange,
|
|
49
53
|
mainItems,
|
|
50
54
|
top,
|
|
51
55
|
bottom,
|
|
52
56
|
navigationComponent,
|
|
53
57
|
}) => {
|
|
54
|
-
const
|
|
55
|
-
|
|
58
|
+
const closeDrawer = () => {
|
|
59
|
+
if (mobile) {
|
|
60
|
+
onDrawerOpenChange?.(false);
|
|
61
|
+
}
|
|
56
62
|
};
|
|
57
63
|
|
|
58
64
|
return (
|
|
59
65
|
<LayoutPlacementContext.Provider value="side">
|
|
66
|
+
{mobile && drawerOpened && (
|
|
67
|
+
<div className={Styles.navDrawerBackdrop} onClick={closeDrawer} />
|
|
68
|
+
)}
|
|
60
69
|
<div
|
|
61
70
|
className={classNames(
|
|
62
71
|
Styles.nav,
|
|
63
72
|
mobile && Styles.navDrawer,
|
|
64
|
-
mobile &&
|
|
73
|
+
mobile && drawerOpened && Styles.navDrawerOpened,
|
|
65
74
|
!mobile && (barExpanded ? Styles.navWide : Styles.navSlim),
|
|
66
75
|
className
|
|
67
76
|
)}
|
|
68
77
|
data-cy="side-navigation"
|
|
69
|
-
onClick={
|
|
78
|
+
onClick={closeDrawer}
|
|
70
79
|
>
|
|
71
80
|
<ThemeProvider mode="dark" className={Styles.navMain}>
|
|
72
81
|
{mobile && (
|
|
@@ -86,7 +95,7 @@ export const LayoutSidebar: FC<LayoutSidebarProps> = ({
|
|
|
86
95
|
item.submenu ? (
|
|
87
96
|
<SideNavigationGroupItem
|
|
88
97
|
key={item.id}
|
|
89
|
-
barExpanded={barExpanded}
|
|
98
|
+
barExpanded={mobile ? drawerOpened : barExpanded}
|
|
90
99
|
submenuExpanded={!!item.id && submenuExpanded === item.id}
|
|
91
100
|
onSubmenuExpand={onSubmenuExpandChange}
|
|
92
101
|
navigationComponent={navigationComponent}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FC,
|
|
3
|
+
PropsWithChildren,
|
|
4
|
+
createContext,
|
|
5
|
+
useCallback,
|
|
6
|
+
useContext,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react';
|
|
10
|
+
|
|
11
|
+
interface NotificationsContextType {
|
|
12
|
+
onNotificationsUpdate: (id: string, hasNotifications: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const NotificationsContext = createContext<NotificationsContextType>({
|
|
16
|
+
onNotificationsUpdate: () => {},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const useNotificationsContext = () => useContext(NotificationsContext);
|
|
20
|
+
|
|
21
|
+
export const useNotificationsState = () => {
|
|
22
|
+
const [hasNotifications, setHasNotifications] = useState(false);
|
|
23
|
+
const items = useRef(new Set<string>());
|
|
24
|
+
const onNotificationsUpdate = useCallback((id: string, hasNotifications: boolean) => {
|
|
25
|
+
if (hasNotifications && !items.current.has(id)) {
|
|
26
|
+
items.current.add(id);
|
|
27
|
+
setHasNotifications(!!items.current.size);
|
|
28
|
+
} else if (!hasNotifications && items.current.has(id)) {
|
|
29
|
+
items.current.delete(id);
|
|
30
|
+
setHasNotifications(!!items.current.size);
|
|
31
|
+
}
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
const NotificationsContextProvider: FC<PropsWithChildren> = useCallback(
|
|
35
|
+
({ children }) => (
|
|
36
|
+
<NotificationsContext.Provider value={{ onNotificationsUpdate }}>
|
|
37
|
+
{children}
|
|
38
|
+
</NotificationsContext.Provider>
|
|
39
|
+
),
|
|
40
|
+
[onNotificationsUpdate]
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return { NotificationsContextProvider, hasNotifications };
|
|
44
|
+
};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
margin-top: var(--nav-offset-top);
|
|
14
14
|
|
|
15
15
|
display: flex;
|
|
16
|
-
flex-direction:
|
|
16
|
+
flex-direction: column;
|
|
17
17
|
|
|
18
18
|
.side {
|
|
19
19
|
flex-basis: var(--nav-offset-left);
|
|
@@ -31,39 +31,45 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.layout-anvil2 {
|
|
34
|
-
.header {
|
|
34
|
+
.content-header {
|
|
35
35
|
position: sticky;
|
|
36
36
|
top: var(--nav-offset-top);
|
|
37
37
|
z-index: 989;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.layout-
|
|
42
|
-
.layout-anvil2 {
|
|
41
|
+
.layout-desktop {
|
|
43
42
|
padding-left: var(--nav-offset-left);
|
|
44
43
|
|
|
45
|
-
.
|
|
46
|
-
|
|
44
|
+
.side {
|
|
45
|
+
position: fixed;
|
|
46
|
+
top: var(--nav-offset-top);
|
|
47
|
+
bottom: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
z-index: @z-index-global-nav;
|
|
47
51
|
}
|
|
52
|
+
}
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
bottom: 0;
|
|
54
|
-
left: 0;
|
|
55
|
-
right: 0;
|
|
56
|
-
z-index: @z-index-global-nav;
|
|
57
|
-
}
|
|
54
|
+
.layout-legacy,
|
|
55
|
+
.layout-anvil2 {
|
|
56
|
+
.top-placeholder {
|
|
57
|
+
height: var(--nav-offset-top);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.layout {
|
|
62
|
-
--nav-offset-top:
|
|
62
|
+
--nav-offset-top: 0px;
|
|
63
|
+
--nav-offset-left: 0px;
|
|
64
|
+
--content-offset-top: var(--nav-offset-top);
|
|
65
|
+
--offset: var(--content-offset-top);
|
|
66
|
+
|
|
67
|
+
&.layout-desktop.layout-top {
|
|
68
|
+
--nav-offset-top: 48px;
|
|
69
|
+
}
|
|
63
70
|
|
|
64
|
-
&.layout-mobile {
|
|
65
|
-
--nav-offset-top:
|
|
66
|
-
--nav-offset-left: 0;
|
|
71
|
+
&.layout-mobile.layout-top {
|
|
72
|
+
--nav-offset-top: 72px;
|
|
67
73
|
}
|
|
68
74
|
|
|
69
75
|
&.layout-desktop.layout-nav-slim {
|
|
@@ -76,9 +82,27 @@
|
|
|
76
82
|
|
|
77
83
|
.top {
|
|
78
84
|
position: fixed;
|
|
85
|
+
width: 100vw;
|
|
79
86
|
top: 0;
|
|
80
87
|
left: 0;
|
|
81
|
-
right: 0;
|
|
82
88
|
z-index: 991;
|
|
83
89
|
}
|
|
90
|
+
|
|
91
|
+
.content-header {
|
|
92
|
+
position: sticky;
|
|
93
|
+
left: 0;
|
|
94
|
+
right: 0;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@media print {
|
|
99
|
+
.layout {
|
|
100
|
+
--nav-offset-left: 0px !important;
|
|
101
|
+
--nav-offset-right: 0px !important;
|
|
102
|
+
|
|
103
|
+
.side,
|
|
104
|
+
.top {
|
|
105
|
+
display: none !important;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
84
108
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const __esModule: true;
|
|
2
2
|
export const content: string;
|
|
3
|
-
export const
|
|
3
|
+
export const contentHeader: string;
|
|
4
4
|
export const layout: string;
|
|
5
5
|
export const layoutAnvil1: string;
|
|
6
6
|
export const layoutAnvil2: string;
|
|
@@ -9,6 +9,7 @@ export const layoutLegacy: string;
|
|
|
9
9
|
export const layoutMobile: string;
|
|
10
10
|
export const layoutNavSlim: string;
|
|
11
11
|
export const layoutNavWide: string;
|
|
12
|
+
export const layoutTop: string;
|
|
12
13
|
export const side: string;
|
|
13
14
|
export const top: string;
|
|
14
15
|
export const topPlaceholder: string;
|
|
@@ -25,6 +25,10 @@ interface LayoutContentArgs {
|
|
|
25
25
|
sideTop: boolean;
|
|
26
26
|
extraText: boolean;
|
|
27
27
|
search: boolean;
|
|
28
|
+
longContent: boolean;
|
|
29
|
+
wideContent: boolean;
|
|
30
|
+
minWidth: boolean;
|
|
31
|
+
emptyNav: boolean;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
export default {
|
|
@@ -37,6 +41,10 @@ export default {
|
|
|
37
41
|
sideTop: true,
|
|
38
42
|
extraText: true,
|
|
39
43
|
search: true,
|
|
44
|
+
longContent: true,
|
|
45
|
+
wideContent: false,
|
|
46
|
+
minWidth: false,
|
|
47
|
+
emptyNav: false,
|
|
40
48
|
} as LayoutContentArgs,
|
|
41
49
|
};
|
|
42
50
|
|
|
@@ -64,6 +72,7 @@ const profile = (
|
|
|
64
72
|
to="https://google.com"
|
|
65
73
|
tooltip="Google it"
|
|
66
74
|
target="_blank"
|
|
75
|
+
tag={{ value: true }}
|
|
67
76
|
>
|
|
68
77
|
first link
|
|
69
78
|
</ProfileDropdown.Link>
|
|
@@ -71,6 +80,7 @@ const profile = (
|
|
|
71
80
|
id="second"
|
|
72
81
|
onClick={() => alert('second click')}
|
|
73
82
|
tooltip="Second hint"
|
|
83
|
+
counter
|
|
74
84
|
>
|
|
75
85
|
second link
|
|
76
86
|
</ProfileDropdown.Section>
|
|
@@ -176,7 +186,9 @@ const ContentHeader = () => {
|
|
|
176
186
|
</Fragment>
|
|
177
187
|
);
|
|
178
188
|
};
|
|
179
|
-
const SearchBar = () =>
|
|
189
|
+
const SearchBar = () => (
|
|
190
|
+
<TextField size="small" placeholder="Search" className="w-100-i m-x-half-i" />
|
|
191
|
+
);
|
|
180
192
|
|
|
181
193
|
const useLayoutProps = (args: LayoutContentArgs): TitanLayoutProps => {
|
|
182
194
|
const [state, setState] = useState<TitanLayoutState | undefined>(undefined);
|
|
@@ -186,7 +198,7 @@ const useLayoutProps = (args: LayoutContentArgs): TitanLayoutProps => {
|
|
|
186
198
|
onStateChange: setState,
|
|
187
199
|
|
|
188
200
|
navigationComponent: NavLinkMock,
|
|
189
|
-
navigationMainItems: mainNavItems,
|
|
201
|
+
navigationMainItems: args.emptyNav ? [] : mainNavItems,
|
|
190
202
|
|
|
191
203
|
profile,
|
|
192
204
|
top: args.search ? <SearchBar /> : undefined,
|
|
@@ -196,15 +208,115 @@ const useLayoutProps = (args: LayoutContentArgs): TitanLayoutProps => {
|
|
|
196
208
|
extraLinksTop,
|
|
197
209
|
extraText: args.extraText ? 'EST (-8 hrs)' : undefined,
|
|
198
210
|
|
|
199
|
-
sideTop: args.sideTop ? sidebarTop() : undefined,
|
|
211
|
+
sideTop: args.sideTop && !args.emptyNav ? sidebarTop() : undefined,
|
|
212
|
+
|
|
213
|
+
minContentWidth: args.minWidth ? 900 : undefined,
|
|
200
214
|
};
|
|
201
215
|
};
|
|
202
216
|
|
|
217
|
+
const Content = (args: LayoutContentArgs) => {
|
|
218
|
+
return (
|
|
219
|
+
<Fragment>
|
|
220
|
+
<LocationInfo className="m-b-3" />
|
|
221
|
+
<div className="m-b-3">rendered - {new Date().toLocaleTimeString()}</div>
|
|
222
|
+
{args.wideContent && (
|
|
223
|
+
<div style={{ width: '1200px' }}>
|
|
224
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
|
225
|
+
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
|
|
226
|
+
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
227
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
|
|
228
|
+
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
|
229
|
+
culpa qui officia deserunt mollit anim id est laborum.
|
|
230
|
+
</div>
|
|
231
|
+
)}
|
|
232
|
+
|
|
233
|
+
{args.longContent && (
|
|
234
|
+
<div>
|
|
235
|
+
<p>Lorem</p>
|
|
236
|
+
<p>ipsum</p>
|
|
237
|
+
<p>dolor</p>
|
|
238
|
+
<p>sit</p>
|
|
239
|
+
<p>amet,</p>
|
|
240
|
+
<p>consectetur</p>
|
|
241
|
+
<p>adipiscing</p>
|
|
242
|
+
<p>elit,</p>
|
|
243
|
+
<p>sed</p>
|
|
244
|
+
<p>do</p>
|
|
245
|
+
<p>eiusmod</p>
|
|
246
|
+
<p>tempor</p>
|
|
247
|
+
<p>incididunt</p>
|
|
248
|
+
<p>ut</p>
|
|
249
|
+
<p>labore</p>
|
|
250
|
+
<p>et</p>
|
|
251
|
+
<p>dolore</p>
|
|
252
|
+
<p>magna</p>
|
|
253
|
+
<p>aliqua.</p>
|
|
254
|
+
<p>Ut</p>
|
|
255
|
+
<p>enim</p>
|
|
256
|
+
<p>ad</p>
|
|
257
|
+
<p>minim</p>
|
|
258
|
+
<p>veniam,</p>
|
|
259
|
+
<p>quis</p>
|
|
260
|
+
<p>nostrud</p>
|
|
261
|
+
<p>exercitation</p>
|
|
262
|
+
<p>ullamco</p>
|
|
263
|
+
<p>laboris</p>
|
|
264
|
+
<p>nisi</p>
|
|
265
|
+
<p>ut</p>
|
|
266
|
+
<p>aliquip</p>
|
|
267
|
+
<p>ex</p>
|
|
268
|
+
<p>ea</p>
|
|
269
|
+
<p>commodo</p>
|
|
270
|
+
<p>consequat.</p>
|
|
271
|
+
<p>Duis</p>
|
|
272
|
+
<p>aute</p>
|
|
273
|
+
<p>irure</p>
|
|
274
|
+
<p>dolor</p>
|
|
275
|
+
<p>in</p>
|
|
276
|
+
<p>reprehenderit</p>
|
|
277
|
+
<p>in</p>
|
|
278
|
+
<p>voluptate</p>
|
|
279
|
+
<p>velit</p>
|
|
280
|
+
<p>esse</p>
|
|
281
|
+
<p>cillum</p>
|
|
282
|
+
<p>dolore</p>
|
|
283
|
+
<p>eu</p>
|
|
284
|
+
<p>fugiat</p>
|
|
285
|
+
<p>nulla</p>
|
|
286
|
+
<p>pariatur.</p>
|
|
287
|
+
<p>Excepteur</p>
|
|
288
|
+
<p>sint</p>
|
|
289
|
+
<p>occaecat</p>
|
|
290
|
+
<p>cupidatat</p>
|
|
291
|
+
<p>non</p>
|
|
292
|
+
<p>proident,</p>
|
|
293
|
+
<p>sunt</p>
|
|
294
|
+
<p>in</p>
|
|
295
|
+
<p>culpa</p>
|
|
296
|
+
<p>qui</p>
|
|
297
|
+
<p>officia</p>
|
|
298
|
+
<p>deserunt</p>
|
|
299
|
+
<p>mollit</p>
|
|
300
|
+
<p>anim</p>
|
|
301
|
+
<p>id</p>
|
|
302
|
+
<p>est</p>
|
|
303
|
+
<p>laborum.</p>
|
|
304
|
+
</div>
|
|
305
|
+
)}
|
|
306
|
+
</Fragment>
|
|
307
|
+
);
|
|
308
|
+
};
|
|
309
|
+
|
|
203
310
|
export const TitanLayoutLegacy = (args: LayoutContentArgs) => (
|
|
204
311
|
<TitanLayout {...useLayoutProps(args)} appearance="legacy">
|
|
205
312
|
<TitanLayout.Logo title />
|
|
206
313
|
<TitanLayout.Content>
|
|
207
|
-
<
|
|
314
|
+
<div
|
|
315
|
+
className="p-3"
|
|
316
|
+
style={{ position: 'absolute', width: 'calc(100% - var(--nav-offset-left));' }}
|
|
317
|
+
>
|
|
318
|
+
<Content {...args} />
|
|
319
|
+
</div>
|
|
208
320
|
</TitanLayout.Content>
|
|
209
321
|
</TitanLayout>
|
|
210
322
|
);
|
|
@@ -214,7 +326,7 @@ export const TitanLayoutAnvil1 = (args: LayoutContentArgs) => (
|
|
|
214
326
|
<TitanLayout.Logo title />
|
|
215
327
|
<TitanLayout.Content>
|
|
216
328
|
<Anvil1Page>
|
|
217
|
-
<
|
|
329
|
+
<Content {...args} />
|
|
218
330
|
</Anvil1Page>
|
|
219
331
|
</TitanLayout.Content>
|
|
220
332
|
</TitanLayout>
|
|
@@ -226,7 +338,7 @@ export const TitanLayoutAnvil2 = (args: LayoutContentArgs) => (
|
|
|
226
338
|
<TitanLayout.Content>
|
|
227
339
|
<Anvil2Page>
|
|
228
340
|
<Anvil2Page.Content>
|
|
229
|
-
<
|
|
341
|
+
<Content {...args} />
|
|
230
342
|
</Anvil2Page.Content>
|
|
231
343
|
</Anvil2Page>
|
|
232
344
|
</TitanLayout.Content>
|