@servicetitan/navigation 11.0.0-canary.237.0ce6038.0 → 11.0.0-canary.237.1127df0.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.
Files changed (91) hide show
  1. package/dist/components/badge-tag.d.ts +1 -1
  2. package/dist/components/badge-tag.d.ts.map +1 -1
  3. package/dist/components/header-navigation/header-navigation-stacked.stories.js +1 -1
  4. package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
  5. package/dist/components/header-navigation/header-navigation.stories.js +1 -1
  6. package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
  7. package/dist/components/left-navigation/header-navigation-tiny.stories.js +2 -2
  8. package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +1 -1
  9. package/dist/components/logo/logo-titan-text.d.ts +1 -1
  10. package/dist/components/logo/logo-titan-text.d.ts.map +1 -1
  11. package/dist/components/profile-dropdown/profile-dropdown.d.ts +10 -7
  12. package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
  13. package/dist/components/profile-dropdown/profile-dropdown.js +2 -2
  14. package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
  15. package/dist/components/profile-dropdown/profile-dropdown.module.less +2 -0
  16. package/dist/components/titan-layout/layout-context.js +1 -1
  17. package/dist/components/titan-layout/layout-context.js.map +1 -1
  18. package/dist/components/titan-layout/layout-header.d.ts +2 -0
  19. package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
  20. package/dist/components/titan-layout/layout-header.js +3 -4
  21. package/dist/components/titan-layout/layout-header.js.map +1 -1
  22. package/dist/components/titan-layout/layout-header.module.less +60 -21
  23. package/dist/components/titan-layout/layout-logo.d.ts.map +1 -1
  24. package/dist/components/titan-layout/layout-logo.js +2 -1
  25. package/dist/components/titan-layout/layout-logo.js.map +1 -1
  26. package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
  27. package/dist/components/titan-layout/layout-profile.js +33 -9
  28. package/dist/components/titan-layout/layout-profile.js.map +1 -1
  29. package/dist/components/titan-layout/layout-profile.stories.d.ts.map +1 -1
  30. package/dist/components/titan-layout/layout-profile.stories.js +1 -1
  31. package/dist/components/titan-layout/layout-profile.stories.js.map +1 -1
  32. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +2 -2
  33. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
  34. package/dist/components/titan-layout/layout-sidebar-links-internal.js +4 -4
  35. package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
  36. package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
  37. package/dist/components/titan-layout/layout-sidebar-links.js +12 -5
  38. package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
  39. package/dist/components/titan-layout/layout-sidebar.d.ts +2 -0
  40. package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
  41. package/dist/components/titan-layout/layout-sidebar.js +6 -4
  42. package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
  43. package/dist/components/titan-layout/layout-sidebar.module.less +29 -6
  44. package/dist/components/titan-layout/notifications-context.d.ts +13 -0
  45. package/dist/components/titan-layout/notifications-context.d.ts.map +1 -0
  46. package/dist/components/titan-layout/notifications-context.js +23 -0
  47. package/dist/components/titan-layout/notifications-context.js.map +1 -0
  48. package/dist/components/titan-layout/titan-layout.d.ts +10 -6
  49. package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
  50. package/dist/components/titan-layout/titan-layout.js +104 -21
  51. package/dist/components/titan-layout/titan-layout.js.map +1 -1
  52. package/dist/components/titan-layout/titan-layout.module.less +50 -20
  53. package/dist/components/titan-layout/titan-layout.stories.d.ts +15 -11
  54. package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
  55. package/dist/components/titan-layout/titan-layout.stories.js +35 -14
  56. package/dist/components/titan-layout/titan-layout.stories.js.map +1 -1
  57. package/dist/test/data.d.ts +4 -1
  58. package/dist/test/data.d.ts.map +1 -1
  59. package/dist/test/data.js +2 -3
  60. package/dist/test/data.js.map +1 -1
  61. package/dist/utils/use-breakpoint.d.ts +1 -0
  62. package/dist/utils/use-breakpoint.d.ts.map +1 -1
  63. package/dist/utils/use-breakpoint.js +3 -2
  64. package/dist/utils/use-breakpoint.js.map +1 -1
  65. package/package.json +2 -2
  66. package/src/components/badge-tag.tsx +1 -1
  67. package/src/components/header-navigation/header-navigation-stacked.stories.tsx +1 -1
  68. package/src/components/header-navigation/header-navigation.stories.tsx +1 -1
  69. package/src/components/left-navigation/header-navigation-tiny.stories.tsx +2 -2
  70. package/src/components/logo/logo-titan-text.tsx +1 -1
  71. package/src/components/profile-dropdown/profile-dropdown.module.less +2 -0
  72. package/src/components/profile-dropdown/profile-dropdown.tsx +13 -6
  73. package/src/components/titan-layout/layout-context.tsx +1 -1
  74. package/src/components/titan-layout/layout-header.module.less +60 -21
  75. package/src/components/titan-layout/layout-header.module.less.d.ts +2 -0
  76. package/src/components/titan-layout/layout-header.tsx +17 -6
  77. package/src/components/titan-layout/layout-logo.tsx +13 -6
  78. package/src/components/titan-layout/layout-profile.stories.tsx +10 -1
  79. package/src/components/titan-layout/layout-profile.tsx +81 -26
  80. package/src/components/titan-layout/layout-sidebar-links-internal.tsx +18 -5
  81. package/src/components/titan-layout/layout-sidebar-links.tsx +21 -5
  82. package/src/components/titan-layout/layout-sidebar.module.less +29 -6
  83. package/src/components/titan-layout/layout-sidebar.module.less.d.ts +1 -0
  84. package/src/components/titan-layout/layout-sidebar.tsx +14 -5
  85. package/src/components/titan-layout/notifications-context.tsx +44 -0
  86. package/src/components/titan-layout/titan-layout.module.less +50 -20
  87. package/src/components/titan-layout/titan-layout.module.less.d.ts +3 -0
  88. package/src/components/titan-layout/titan-layout.stories.tsx +166 -19
  89. package/src/components/titan-layout/titan-layout.tsx +265 -76
  90. package/src/test/data.tsx +2 -3
  91. package/src/utils/use-breakpoint.ts +3 -1
@@ -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>;
@@ -17,7 +18,14 @@ const WrappedLink: FC<{
17
18
 
18
19
  /** Side Navigation menu link */
19
20
  export function TitanLayoutSidebarLink({ wrapper, ...props }: TitanLayoutSidebarLinkProps) {
20
- const { NavigationComponent } = useTitanLayoutContext();
21
+ const {
22
+ NavigationComponent,
23
+ breakpoint: { isMobile },
24
+ } = useTitanLayoutContext();
25
+ const { onNotificationsUpdate } = useNotificationsContext();
26
+ const tag = getCounterTag(props.counter, props.tag);
27
+
28
+ onNotificationsUpdate(props.id, !!tag);
21
29
 
22
30
  const element = (
23
31
  <InternalSideNavigationLink
@@ -25,11 +33,11 @@ export function TitanLayoutSidebarLink({ wrapper, ...props }: TitanLayoutSidebar
25
33
  navigationComponent={NavigationComponent}
26
34
  submenuExpanded={undefined}
27
35
  dataPrefix="navigation-link"
28
- tag={getCounterTag(props.counter, props.tag)}
36
+ tag={tag}
29
37
  />
30
38
  );
31
39
 
32
- return wrapper ? <WrappedLink wrapper={wrapper}>{element}</WrappedLink> : element;
40
+ return wrapper && !isMobile ? <WrappedLink wrapper={wrapper}>{element}</WrappedLink> : element;
33
41
  }
34
42
 
35
43
  /** Side Navigation menu trigger */
@@ -42,15 +50,23 @@ export function TitanLayoutSidebarTrigger({
42
50
  const {
43
51
  breakpoint: { isMobile },
44
52
  } = useTitanLayoutContext();
53
+ const { onNotificationsUpdate } = useNotificationsContext();
54
+ const tag = getCounterTag(props.counter, props.tag);
55
+
56
+ onNotificationsUpdate(props.id, !!tag);
45
57
 
46
58
  const element = (
47
59
  <InternalSideNavigationTrigger
48
60
  {...props}
49
61
  submenuExpanded={undefined}
50
62
  dataPrefix="navigation-trigger"
51
- tag={getCounterTag(props.counter, props.tag)}
63
+ tag={tag}
52
64
  onClick={isMobile && !!onMobileClick ? onMobileClick : onClick}
53
65
  />
54
66
  );
55
- return wrapper && !isMobile ? <WrappedLink wrapper={wrapper}>{element}</WrappedLink> : element;
67
+ return wrapper && (!isMobile || !onMobileClick) ? (
68
+ <WrappedLink wrapper={wrapper}>{element}</WrappedLink>
69
+ ) : (
70
+ element
71
+ );
56
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
- bottom: 0;
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) {
@@ -141,7 +158,11 @@
141
158
  // desktop version expanded
142
159
  .nav-wide {
143
160
  width: var(--nav-offset-left);
144
- padding-top: @spacing-2;
161
+
162
+ .nav-item {
163
+ margin-left: @spacing-1;
164
+ margin-right: @spacing-1;
165
+ }
145
166
 
146
167
  .toggle {
147
168
  .toggle-content {
@@ -162,14 +183,16 @@
162
183
  margin-top: @spacing-1;
163
184
  margin-bottom: @spacing-1;
164
185
  }
186
+
187
+ .nav-main {
188
+ padding-top: @spacing-1;
189
+ }
165
190
  }
166
191
 
167
192
  .nav-drawer,
168
193
  .nav-wide {
169
194
  .nav-item {
170
195
  flex-direction: row;
171
- margin-left: @spacing-1;
172
- margin-right: @spacing-1;
173
196
 
174
197
  .nav-item-icon-wrapper {
175
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 handleClick = (e: MouseEvent<never>) => {
55
- e.stopPropagation();
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 && barExpanded && Styles.navDrawerOpened,
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={handleClick}
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: row;
16
+ flex-direction: column;
17
17
 
18
18
  .side {
19
19
  flex-basis: var(--nav-offset-left);
@@ -30,47 +30,77 @@
30
30
  }
31
31
  }
32
32
 
33
- .layout-legacy,
34
33
  .layout-anvil2 {
34
+ .content-header {
35
+ position: sticky;
36
+ top: var(--nav-offset-top);
37
+ z-index: 989;
38
+ }
39
+ }
40
+
41
+ .layout-desktop {
35
42
  padding-left: var(--nav-offset-left);
36
43
 
37
- .top-placeholder {
38
- height: var(--nav-offset-top);
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;
39
51
  }
52
+ }
40
53
 
41
- &:not(.layout-mobile) {
42
- .side {
43
- position: fixed;
44
- top: var(--nav-offset-top);
45
- bottom: 0;
46
- left: 0;
47
- right: 0;
48
- z-index: @z-index-global-nav;
49
- }
54
+ .layout-legacy,
55
+ .layout-anvil2 {
56
+ .top-placeholder {
57
+ height: var(--nav-offset-top);
50
58
  }
51
59
  }
52
60
 
53
61
  .layout {
54
- --nav-offset-top: 49px;
62
+ --nav-offset-top: 0px;
63
+ --nav-offset-left: 0px;
64
+
65
+ &.layout-desktop.layout-top {
66
+ --nav-offset-top: 48px;
67
+ }
55
68
 
56
- &.layout-mobile {
57
- --nav-offset-top: 61px;
58
- --nav-offset-left: 0;
69
+ &.layout-mobile.layout-top {
70
+ --nav-offset-top: 72px;
59
71
  }
60
72
 
61
- &.layout-nav-slim {
73
+ &.layout-desktop.layout-nav-slim {
62
74
  --nav-offset-left: 64px;
63
75
  }
64
76
 
65
- &.layout-nav-wide {
77
+ &.layout-desktop.layout-nav-wide {
66
78
  --nav-offset-left: 212px;
67
79
  }
68
80
 
69
81
  .top {
70
82
  position: fixed;
83
+ width: 100vw;
71
84
  top: 0;
72
85
  left: 0;
73
- right: 0;
74
86
  z-index: 991;
75
87
  }
88
+
89
+ .content-header {
90
+ position: sticky;
91
+ left: 0;
92
+ right: 0;
93
+ }
94
+ }
95
+
96
+ @media print {
97
+ .layout {
98
+ --nav-offset-left: 0px !important;
99
+ --nav-offset-right: 0px !important;
100
+
101
+ .side,
102
+ .top {
103
+ display: none !important;
104
+ }
105
+ }
76
106
  }
@@ -1,12 +1,15 @@
1
1
  export const __esModule: true;
2
2
  export const content: string;
3
+ export const contentHeader: string;
3
4
  export const layout: string;
4
5
  export const layoutAnvil1: string;
5
6
  export const layoutAnvil2: string;
7
+ export const layoutDesktop: string;
6
8
  export const layoutLegacy: string;
7
9
  export const layoutMobile: string;
8
10
  export const layoutNavSlim: string;
9
11
  export const layoutNavWide: string;
12
+ export const layoutTop: string;
10
13
  export const side: string;
11
14
  export const top: string;
12
15
  export const topPlaceholder: string;
@@ -1,4 +1,4 @@
1
- import { Page as Anvil2Page, Popover } from '@servicetitan/anvil2';
1
+ import { Announcement, Page as Anvil2Page, Button, Popover, TextField } from '@servicetitan/anvil2';
2
2
  import SvgSearch from '@servicetitan/anvil2/assets/icons/material/round/search.svg';
3
3
  import SvgAtlas from '@servicetitan/anvil2/assets/icons/st/atlas_logo.svg';
4
4
  import SvgSettingsActive from '@servicetitan/anvil2/assets/icons/st/gnav_settings_active.svg';
@@ -20,11 +20,32 @@ import { SideNavigationLinkWrapperProps } from '../left-navigation';
20
20
  import { HeaderNavigationLink, HeaderNavigationTrigger } from '../links';
21
21
  import { ProfileDropdown, TitanLayout, TitanLayoutProps, TitanLayoutState } from './';
22
22
 
23
+ interface LayoutContentArgs {
24
+ header: boolean;
25
+ sideTop: boolean;
26
+ extraText: boolean;
27
+ search: boolean;
28
+ longContent: boolean;
29
+ wideContent: boolean;
30
+ minWidth: boolean;
31
+ emptyNav: boolean;
32
+ }
33
+
23
34
  export default {
24
35
  title: 'Navigation/TitanLayout',
25
- component: TitanLayout,
26
36
  decorators: [withDefaultRedirects, withMemoryRouter, withAnvil],
27
37
  parameters: {},
38
+ argTypes: {},
39
+ args: {
40
+ header: true,
41
+ sideTop: true,
42
+ extraText: true,
43
+ search: true,
44
+ longContent: true,
45
+ wideContent: false,
46
+ minWidth: false,
47
+ emptyNav: false,
48
+ } as LayoutContentArgs,
28
49
  };
29
50
 
30
51
  const mainNavItems = [
@@ -51,6 +72,7 @@ const profile = (
51
72
  to="https://google.com"
52
73
  tooltip="Google it"
53
74
  target="_blank"
75
+ tag={{ value: true }}
54
76
  >
55
77
  first link
56
78
  </ProfileDropdown.Link>
@@ -131,9 +153,9 @@ const SideLinkPopoverWrapper: FC<SideNavigationLinkWrapperProps> = ({ children,
131
153
  };
132
154
 
133
155
  const sidebarTop = () => [
134
- <TitanLayout.SidebarLink key="tasks" {...items.tasks} />,
135
- <TitanLayout.SidebarLink key="calls" {...items.calls} />,
136
- <TitanLayout.SidebarTrigger
156
+ <TitanLayout.Link key="tasks" {...items.tasks} />,
157
+ <TitanLayout.Link key="calls" {...items.calls} />,
158
+ <TitanLayout.Trigger
137
159
  key="marketing"
138
160
  {...items.marketing}
139
161
  isActive={false}
@@ -142,51 +164,176 @@ const sidebarTop = () => [
142
164
  counter={50}
143
165
  />,
144
166
  ];
145
- const useLayoutProps = (): TitanLayoutProps => {
167
+ const ContentHeader = () => {
168
+ const [longInfo, setLongInfo] = useState(false);
169
+
170
+ return (
171
+ <Fragment>
172
+ <Announcement title="Some info" status="info" />
173
+ <Announcement title="Some warning" status="warning" />
174
+ <div
175
+ className="d-f justify-content-center align-items-center bg-purple-100-i"
176
+ style={{ height: longInfo ? '120px' : '48px' }}
177
+ >
178
+ <div className="d-f align-items-center gap-1">
179
+ custom content{' '}
180
+ <Button onClick={() => setLongInfo(!longInfo)} size="small" aria-label="test">
181
+ {longInfo ? '↑' : '↓'}
182
+ </Button>
183
+ </div>
184
+ </div>
185
+ </Fragment>
186
+ );
187
+ };
188
+ const SearchBar = () => (
189
+ <TextField size="small" placeholder="Search" className="w-100-i m-x-half-i" />
190
+ );
191
+
192
+ const useLayoutProps = (args: LayoutContentArgs): TitanLayoutProps => {
146
193
  const [state, setState] = useState<TitanLayoutState | undefined>(undefined);
147
194
 
148
195
  return {
149
196
  state,
150
197
  onStateChange: setState,
151
198
 
152
- navigationMainItems: mainNavItems,
199
+ navigationComponent: NavLinkMock,
200
+ navigationMainItems: args.emptyNav ? [] : mainNavItems,
201
+
153
202
  profile,
203
+ top: args.search ? <SearchBar /> : undefined,
204
+ header: args.header ? <ContentHeader /> : undefined,
205
+
154
206
  extraLinks,
155
207
  extraLinksTop,
208
+ extraText: args.extraText ? 'EST (-8 hrs)' : undefined,
156
209
 
157
- sidebarTop: sidebarTop(),
158
- navigationComponent: NavLinkMock,
159
- extraText: 'EST (-8 hrs)',
210
+ sideTop: args.sideTop && !args.emptyNav ? sidebarTop() : undefined,
211
+
212
+ minContentWidth: args.minWidth ? 900 : undefined,
160
213
  };
161
214
  };
162
215
 
163
- export const TitanLayoutLegacy = () => (
164
- <TitanLayout {...useLayoutProps()} appearance="legacy">
216
+ const Content = (args: LayoutContentArgs) => {
217
+ return (
218
+ <Fragment>
219
+ <LocationInfo className="m-b-3" />
220
+ {args.wideContent && (
221
+ <div style={{ width: '1200px' }}>
222
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
223
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
224
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
225
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
226
+ fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
227
+ culpa qui officia deserunt mollit anim id est laborum.
228
+ </div>
229
+ )}
230
+
231
+ {args.longContent && (
232
+ <div>
233
+ <p>Lorem</p>
234
+ <p>ipsum</p>
235
+ <p>dolor</p>
236
+ <p>sit</p>
237
+ <p>amet,</p>
238
+ <p>consectetur</p>
239
+ <p>adipiscing</p>
240
+ <p>elit,</p>
241
+ <p>sed</p>
242
+ <p>do</p>
243
+ <p>eiusmod</p>
244
+ <p>tempor</p>
245
+ <p>incididunt</p>
246
+ <p>ut</p>
247
+ <p>labore</p>
248
+ <p>et</p>
249
+ <p>dolore</p>
250
+ <p>magna</p>
251
+ <p>aliqua.</p>
252
+ <p>Ut</p>
253
+ <p>enim</p>
254
+ <p>ad</p>
255
+ <p>minim</p>
256
+ <p>veniam,</p>
257
+ <p>quis</p>
258
+ <p>nostrud</p>
259
+ <p>exercitation</p>
260
+ <p>ullamco</p>
261
+ <p>laboris</p>
262
+ <p>nisi</p>
263
+ <p>ut</p>
264
+ <p>aliquip</p>
265
+ <p>ex</p>
266
+ <p>ea</p>
267
+ <p>commodo</p>
268
+ <p>consequat.</p>
269
+ <p>Duis</p>
270
+ <p>aute</p>
271
+ <p>irure</p>
272
+ <p>dolor</p>
273
+ <p>in</p>
274
+ <p>reprehenderit</p>
275
+ <p>in</p>
276
+ <p>voluptate</p>
277
+ <p>velit</p>
278
+ <p>esse</p>
279
+ <p>cillum</p>
280
+ <p>dolore</p>
281
+ <p>eu</p>
282
+ <p>fugiat</p>
283
+ <p>nulla</p>
284
+ <p>pariatur.</p>
285
+ <p>Excepteur</p>
286
+ <p>sint</p>
287
+ <p>occaecat</p>
288
+ <p>cupidatat</p>
289
+ <p>non</p>
290
+ <p>proident,</p>
291
+ <p>sunt</p>
292
+ <p>in</p>
293
+ <p>culpa</p>
294
+ <p>qui</p>
295
+ <p>officia</p>
296
+ <p>deserunt</p>
297
+ <p>mollit</p>
298
+ <p>anim</p>
299
+ <p>id</p>
300
+ <p>est</p>
301
+ <p>laborum.</p>
302
+ </div>
303
+ )}
304
+ </Fragment>
305
+ );
306
+ };
307
+
308
+ export const TitanLayoutLegacy = (args: LayoutContentArgs) => (
309
+ <TitanLayout {...useLayoutProps(args)} appearance="legacy">
165
310
  <TitanLayout.Logo title />
166
311
  <TitanLayout.Content>
167
- <LocationInfo />
312
+ <div className="p-3">
313
+ <Content {...args} />
314
+ </div>
168
315
  </TitanLayout.Content>
169
316
  </TitanLayout>
170
317
  );
171
318
 
172
- export const TitanLayoutAnvil1 = () => (
173
- <TitanLayout {...useLayoutProps()} appearance="anvil1">
319
+ export const TitanLayoutAnvil1 = (args: LayoutContentArgs) => (
320
+ <TitanLayout {...useLayoutProps(args)} appearance="anvil1">
174
321
  <TitanLayout.Logo title />
175
322
  <TitanLayout.Content>
176
323
  <Anvil1Page>
177
- <LocationInfo />
324
+ <Content {...args} />
178
325
  </Anvil1Page>
179
326
  </TitanLayout.Content>
180
327
  </TitanLayout>
181
328
  );
182
329
 
183
- export const TitanLayoutAnvil2 = () => (
184
- <TitanLayout {...useLayoutProps()} appearance="anvil2">
330
+ export const TitanLayoutAnvil2 = (args: LayoutContentArgs) => (
331
+ <TitanLayout {...useLayoutProps(args)} appearance="anvil2">
185
332
  <TitanLayout.Logo title />
186
333
  <TitanLayout.Content>
187
334
  <Anvil2Page>
188
335
  <Anvil2Page.Content>
189
- <LocationInfo />
336
+ <Content {...args} />
190
337
  </Anvil2Page.Content>
191
338
  </Anvil2Page>
192
339
  </TitanLayout.Content>