@atlaskit/side-navigation 1.1.2
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/CHANGELOG.md +517 -0
- package/LICENSE +13 -0
- package/README.md +16 -0
- package/build/tsconfig.json +17 -0
- package/codemods/0.8.0-change-css-fn-prop.ts +184 -0
- package/codemods/__tests__/0.8.0-change-css-fn-prop.ts +360 -0
- package/codemods/helpers/generic.ts +674 -0
- package/dist/cjs/common/constants.js +10 -0
- package/dist/cjs/common/styles.js +104 -0
- package/dist/cjs/components/Footer/index.js +67 -0
- package/dist/cjs/components/Header/index.js +73 -0
- package/dist/cjs/components/Item/button-item.js +47 -0
- package/dist/cjs/components/Item/custom-item.js +52 -0
- package/dist/cjs/components/Item/go-back-item.js +65 -0
- package/dist/cjs/components/Item/index.js +47 -0
- package/dist/cjs/components/Item/link-item.js +47 -0
- package/dist/cjs/components/Item/skeleton-item.js +43 -0
- package/dist/cjs/components/LoadingItems/index.js +51 -0
- package/dist/cjs/components/NavigationContent/index.js +52 -0
- package/dist/cjs/components/NavigationContent/styles.js +152 -0
- package/dist/cjs/components/NavigationFooter/index.js +27 -0
- package/dist/cjs/components/NavigationHeader/index.js +27 -0
- package/dist/cjs/components/NestableNavigationContent/context.js +51 -0
- package/dist/cjs/components/NestableNavigationContent/index.js +182 -0
- package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +40 -0
- package/dist/cjs/components/NestingItem/hack-for-ert.js +8 -0
- package/dist/cjs/components/NestingItem/index.js +173 -0
- package/dist/cjs/components/NestingItem/styles.js +47 -0
- package/dist/cjs/components/Section/heading-item.js +35 -0
- package/dist/cjs/components/Section/index.js +31 -0
- package/dist/cjs/components/Section/section.js +45 -0
- package/dist/cjs/components/Section/skeleton-heading-item.js +39 -0
- package/dist/cjs/components/SideNavigation/index.js +41 -0
- package/dist/cjs/components/index.js +131 -0
- package/dist/cjs/index.js +131 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/common/constants.js +2 -0
- package/dist/es2019/common/styles.js +78 -0
- package/dist/es2019/components/Footer/index.js +52 -0
- package/dist/es2019/components/Header/index.js +46 -0
- package/dist/es2019/components/Item/button-item.js +25 -0
- package/dist/es2019/components/Item/custom-item.js +31 -0
- package/dist/es2019/components/Item/go-back-item.js +34 -0
- package/dist/es2019/components/Item/index.js +5 -0
- package/dist/es2019/components/Item/link-item.js +25 -0
- package/dist/es2019/components/Item/skeleton-item.js +28 -0
- package/dist/es2019/components/LoadingItems/index.js +38 -0
- package/dist/es2019/components/NavigationContent/index.js +38 -0
- package/dist/es2019/components/NavigationContent/styles.js +120 -0
- package/dist/es2019/components/NavigationFooter/index.js +18 -0
- package/dist/es2019/components/NavigationHeader/index.js +20 -0
- package/dist/es2019/components/NestableNavigationContent/context.js +41 -0
- package/dist/es2019/components/NestableNavigationContent/index.js +148 -0
- package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +21 -0
- package/dist/es2019/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/es2019/components/NestingItem/index.js +128 -0
- package/dist/es2019/components/NestingItem/styles.js +39 -0
- package/dist/es2019/components/Section/heading-item.js +22 -0
- package/dist/es2019/components/Section/index.js +3 -0
- package/dist/es2019/components/Section/section.js +25 -0
- package/dist/es2019/components/Section/skeleton-heading-item.js +24 -0
- package/dist/es2019/components/SideNavigation/index.js +30 -0
- package/dist/es2019/components/index.js +11 -0
- package/dist/es2019/index.js +3 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/common/constants.js +2 -0
- package/dist/esm/common/styles.js +82 -0
- package/dist/esm/components/Footer/index.js +51 -0
- package/dist/esm/components/Header/index.js +50 -0
- package/dist/esm/components/Item/button-item.js +25 -0
- package/dist/esm/components/Item/custom-item.js +31 -0
- package/dist/esm/components/Item/go-back-item.js +41 -0
- package/dist/esm/components/Item/index.js +5 -0
- package/dist/esm/components/Item/link-item.js +25 -0
- package/dist/esm/components/Item/skeleton-item.js +29 -0
- package/dist/esm/components/LoadingItems/index.js +39 -0
- package/dist/esm/components/NavigationContent/index.js +37 -0
- package/dist/esm/components/NavigationContent/styles.js +130 -0
- package/dist/esm/components/NavigationFooter/index.js +17 -0
- package/dist/esm/components/NavigationHeader/index.js +18 -0
- package/dist/esm/components/NestableNavigationContent/context.js +36 -0
- package/dist/esm/components/NestableNavigationContent/index.js +163 -0
- package/dist/esm/components/NestableNavigationContent/nesting-motion.js +28 -0
- package/dist/esm/components/NestingItem/hack-for-ert.js +1 -0
- package/dist/esm/components/NestingItem/index.js +144 -0
- package/dist/esm/components/NestingItem/styles.js +34 -0
- package/dist/esm/components/Section/heading-item.js +21 -0
- package/dist/esm/components/Section/index.js +3 -0
- package/dist/esm/components/Section/section.js +24 -0
- package/dist/esm/components/Section/skeleton-heading-item.js +25 -0
- package/dist/esm/components/SideNavigation/index.js +28 -0
- package/dist/esm/components/index.js +11 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/styles.d.ts +10 -0
- package/dist/types/components/Footer/index.d.ts +4 -0
- package/dist/types/components/Header/index.d.ts +43 -0
- package/dist/types/components/Item/button-item.d.ts +5 -0
- package/dist/types/components/Item/custom-item.d.ts +13 -0
- package/dist/types/components/Item/go-back-item.d.ts +5 -0
- package/dist/types/components/Item/index.d.ts +10 -0
- package/dist/types/components/Item/link-item.d.ts +5 -0
- package/dist/types/components/Item/skeleton-item.d.ts +4 -0
- package/dist/types/components/LoadingItems/index.d.ts +30 -0
- package/dist/types/components/NavigationContent/index.d.ts +17 -0
- package/dist/types/components/NavigationContent/styles.d.ts +91 -0
- package/dist/types/components/NavigationFooter/index.d.ts +7 -0
- package/dist/types/components/NavigationHeader/index.d.ts +5 -0
- package/dist/types/components/NestableNavigationContent/context.d.ts +20 -0
- package/dist/types/components/NestableNavigationContent/index.d.ts +58 -0
- package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +18 -0
- package/dist/types/components/NestingItem/hack-for-ert.d.ts +2 -0
- package/dist/types/components/NestingItem/index.d.ts +91 -0
- package/dist/types/components/NestingItem/styles.d.ts +28 -0
- package/dist/types/components/Section/heading-item.d.ts +4 -0
- package/dist/types/components/Section/index.d.ts +6 -0
- package/dist/types/components/Section/section.d.ts +25 -0
- package/dist/types/components/Section/skeleton-heading-item.d.ts +4 -0
- package/dist/types/components/SideNavigation/index.d.ts +23 -0
- package/dist/types/components/index.d.ts +22 -0
- package/dist/types/index.d.ts +4 -0
- package/docs/00-intro.tsx +70 -0
- package/docs/01-side-navigation.tsx +33 -0
- package/docs/02-navigation-header.tsx +39 -0
- package/docs/03-navigation-content.tsx +40 -0
- package/docs/04-nestable-navigation-content.tsx +95 -0
- package/docs/05-navigation-footer.tsx +38 -0
- package/docs/99-loading-states.tsx +95 -0
- package/docs/button-item.tsx +38 -0
- package/docs/custom-item.tsx +45 -0
- package/docs/go-back-item.tsx +31 -0
- package/docs/heading-item.tsx +30 -0
- package/docs/link-item.tsx +39 -0
- package/docs/nesting-item.tsx +52 -0
- package/docs/section.tsx +40 -0
- package/docs/skeleton-heading-item.tsx +30 -0
- package/docs/skeleton-item.tsx +30 -0
- package/package.json +71 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface SideNavigationProps {
|
|
3
|
+
/**
|
|
4
|
+
* Describes the specific role of this navigation component for users viewing the page with a screen reader.
|
|
5
|
+
* Differentiates from other navigation components on a page.
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Child navigation elements.
|
|
10
|
+
* You'll want to compose children from [navigation header](/packages/navigation/side-navigation/docs/navigation-header),
|
|
11
|
+
* [navigation content](/packages/navigation/side-navigation/docs/navigation-content) or [nestable navigation content](/packages/navigation/side-navigation/docs/nestable-navigation-content),
|
|
12
|
+
* and [navigation footer](/packages/navigation/side-navigation/docs/navigation-footer).
|
|
13
|
+
*/
|
|
14
|
+
children: JSX.Element[] | JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* A `testId` prop is provided for specified elements,
|
|
17
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
18
|
+
* serving as a hook for automated tests.
|
|
19
|
+
*/
|
|
20
|
+
testId?: string;
|
|
21
|
+
}
|
|
22
|
+
declare const SideNavigation: import("react").ForwardRefExoticComponent<SideNavigationProps & import("react").RefAttributes<HTMLElement>>;
|
|
23
|
+
export default SideNavigation;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { default as SideNavigation } from './SideNavigation';
|
|
2
|
+
export type { SideNavigationProps } from './SideNavigation';
|
|
3
|
+
export { Section, HeadingItem, SkeletonHeadingItem } from './Section';
|
|
4
|
+
export type { HeadingItemProps, SectionProps, SkeletonHeadingItemProps, } from './Section';
|
|
5
|
+
export { default as NestingItem } from './NestingItem';
|
|
6
|
+
export type { NestingItemProps } from './NestingItem';
|
|
7
|
+
export { default as NavigationContent } from './NavigationContent';
|
|
8
|
+
export type { NavigationContentProps } from './NavigationContent';
|
|
9
|
+
export { ButtonItem, GoBackItem, LinkItem, CustomItem, SkeletonItem, } from './Item';
|
|
10
|
+
export type { CustomItemComponentProps, CustomItemProps, ButtonItemProps, GoBackItemProps, LinkItemProps, SkeletonItemProps, } from './Item';
|
|
11
|
+
export { default as Footer } from './Footer';
|
|
12
|
+
export type { FooterProps } from './Footer';
|
|
13
|
+
export { default as Header } from './Header';
|
|
14
|
+
export type { HeaderProps } from './Header';
|
|
15
|
+
export { default as NavigationHeader } from './NavigationHeader';
|
|
16
|
+
export type { NavigationHeaderProps } from './NavigationHeader';
|
|
17
|
+
export { default as NavigationFooter } from './NavigationFooter';
|
|
18
|
+
export type { NavigationFooterProps } from './NavigationFooter';
|
|
19
|
+
export { default as LoadingItems } from './LoadingItems';
|
|
20
|
+
export type { LoadingItemsProps } from './LoadingItems';
|
|
21
|
+
export { default as NestableNavigationContent } from './NestableNavigationContent';
|
|
22
|
+
export type { NestableNavigationContentProps } from './NestableNavigationContent';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SideNavigation, Header, NavigationHeader, NavigationContent, Section, HeadingItem, SkeletonHeadingItem, NestableNavigationContent, NestingItem, ButtonItem, LinkItem, GoBackItem, CustomItem, SkeletonItem, Footer, NavigationFooter, LoadingItems, } from './components';
|
|
2
|
+
export type { CustomItemComponentProps, CustomItemProps, LoadingItemsProps, ButtonItemProps, FooterProps, GoBackItemProps, HeaderProps, HeadingItemProps, LinkItemProps, NavigationContentProps, NavigationFooterProps, NavigationHeaderProps, NestableNavigationContentProps, NestingItemProps, SectionProps, SideNavigationProps, SkeletonHeadingItemProps, SkeletonItemProps, } from './components';
|
|
3
|
+
export { useShouldNestedElementRender } from './components/NestableNavigationContent/context';
|
|
4
|
+
export { VAR_SCROLL_INDICATOR_COLOR, VAR_SEPARATOR_COLOR, } from './common/constants';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { code, Example, md } from '@atlaskit/docs';
|
|
4
|
+
|
|
5
|
+
export default md`
|
|
6
|
+
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
All the documentation can be found in the **sidebar nav links** 👈
|
|
10
|
+
|
|
11
|
+
- [Side navigation](side-navigation/docs/side-navigation)
|
|
12
|
+
- [Navigation header](side-navigation/docs/navigation-header)
|
|
13
|
+
- [Navigation content](side-navigation/docs/navigation-content)
|
|
14
|
+
- [Nestable navigation content](side-navigation/docs/nestable-navigation-content)
|
|
15
|
+
- [Navigation footer](side-navigation/docs/navigation-content)
|
|
16
|
+
- [Loading states](side-navigation/docs/loading-states)
|
|
17
|
+
- [Button item](side-navigation/docs/button-item)
|
|
18
|
+
- [Custom item](side-navigation/docs/custom-item)
|
|
19
|
+
- [Go back item](side-navigation/docs/go-back-item)
|
|
20
|
+
- [Link item](side-navigation/docs/link-item)
|
|
21
|
+
- [Nesting item](side-navigation/docs/nesting-item)
|
|
22
|
+
- [Heading item](side-navigation/docs/heading-item)
|
|
23
|
+
- [Section](side-navigation/docs/section)
|
|
24
|
+
- [Skeleton item](side-navigation/docs/skeleton-item)
|
|
25
|
+
- [Skeleton heading item](side-navigation/docs/skeleton-heading-item)
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
${code`
|
|
30
|
+
import {
|
|
31
|
+
SideNavigation,
|
|
32
|
+
Section,
|
|
33
|
+
NavigationHeader,
|
|
34
|
+
Header,
|
|
35
|
+
NestableNavigationContent,
|
|
36
|
+
ButtonItem,
|
|
37
|
+
NestingItem,
|
|
38
|
+
Footer,
|
|
39
|
+
NavigationFooter,
|
|
40
|
+
} from '@atlaskit/side-navigation';
|
|
41
|
+
|
|
42
|
+
<SideNavigation label="project">
|
|
43
|
+
<NavigationHeader>
|
|
44
|
+
<Header>NXTGen Industries</Header>
|
|
45
|
+
</NavigationHeader>
|
|
46
|
+
<NestableNavigationContent>
|
|
47
|
+
<Section>
|
|
48
|
+
<ButtonItem>Your work</ButtonItem>
|
|
49
|
+
<NestingItem title="Filters">
|
|
50
|
+
<Section>
|
|
51
|
+
<ButtonItem>Search issues</ButtonItem>
|
|
52
|
+
</Section>
|
|
53
|
+
</NestingItem>
|
|
54
|
+
</Section>
|
|
55
|
+
</NestableNavigationContent>
|
|
56
|
+
<NavigationFooter>
|
|
57
|
+
<Footer>You're in a next-gen project</Footer>
|
|
58
|
+
</NavigationFooter>
|
|
59
|
+
</SideNavigation>
|
|
60
|
+
`}
|
|
61
|
+
|
|
62
|
+
${(
|
|
63
|
+
<Example
|
|
64
|
+
title=""
|
|
65
|
+
Component={require('../examples/00-nested-side-navigation').default}
|
|
66
|
+
source={require('!!raw-loader!../examples/00-nested-side-navigation')}
|
|
67
|
+
packageName="@atlaskit/sidebar-navigation"
|
|
68
|
+
/>
|
|
69
|
+
)}
|
|
70
|
+
`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { code, Example, md, Props } from '@atlaskit/docs';
|
|
4
|
+
|
|
5
|
+
export default md`
|
|
6
|
+
This is the root component you should use every time you want a side navigation experience.
|
|
7
|
+
It will take up \`100%\` of its parents height & width -
|
|
8
|
+
so make sure you place it into an element that **has its height & width explicitly set**.
|
|
9
|
+
Comes with a minimum width of \`240px\`.
|
|
10
|
+
|
|
11
|
+
${code`highlight=1,3,5
|
|
12
|
+
import { SideNavigation } from '@atlaskit/side-navigation';
|
|
13
|
+
|
|
14
|
+
<SideNavigation label="project">
|
|
15
|
+
...
|
|
16
|
+
</SideNavigation>
|
|
17
|
+
`}
|
|
18
|
+
|
|
19
|
+
${(
|
|
20
|
+
<Example
|
|
21
|
+
title=""
|
|
22
|
+
Component={require('../examples/side-navigation.tsx').default}
|
|
23
|
+
source={require('!!raw-loader!../examples/side-navigation.tsx')}
|
|
24
|
+
/>
|
|
25
|
+
)}
|
|
26
|
+
|
|
27
|
+
${(
|
|
28
|
+
<Props
|
|
29
|
+
heading="Props"
|
|
30
|
+
props={require('!!extract-react-types-loader!../src/components/SideNavigation')}
|
|
31
|
+
/>
|
|
32
|
+
)}
|
|
33
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { code, Example, md, Props } from '@atlaskit/docs';
|
|
4
|
+
|
|
5
|
+
export default md`
|
|
6
|
+
Header for the side navigation that is composed of navigation header and header components.
|
|
7
|
+
By default it will _not be interactive_ -
|
|
8
|
+
however you can pass in your own custom component to make it interactive.
|
|
9
|
+
|
|
10
|
+
${code`
|
|
11
|
+
import { NavigationHeader, Header } from '@atlaskit/side-navigation';
|
|
12
|
+
|
|
13
|
+
<NavigationHeader>
|
|
14
|
+
<Header>My header</Header>
|
|
15
|
+
</NavigationHeader>
|
|
16
|
+
`}
|
|
17
|
+
|
|
18
|
+
${(
|
|
19
|
+
<Example
|
|
20
|
+
title=""
|
|
21
|
+
Component={require('../examples/navigation-header.tsx').default}
|
|
22
|
+
source={require('!!raw-loader!../examples/navigation-header.tsx')}
|
|
23
|
+
/>
|
|
24
|
+
)}
|
|
25
|
+
|
|
26
|
+
${(
|
|
27
|
+
<Props
|
|
28
|
+
heading="Navigation header props"
|
|
29
|
+
props={require('!!extract-react-types-loader!../src/components/NavigationHeader')}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
32
|
+
|
|
33
|
+
${(
|
|
34
|
+
<Props
|
|
35
|
+
heading="Header props"
|
|
36
|
+
props={require('!!extract-react-types-loader!../src/components/Header')}
|
|
37
|
+
/>
|
|
38
|
+
)}
|
|
39
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { code, Example, md, Props } from '@atlaskit/docs';
|
|
4
|
+
|
|
5
|
+
export default md`
|
|
6
|
+
Used as the container for navigation items.
|
|
7
|
+
This is useful for a single level navigation with no need for nested views.
|
|
8
|
+
If you have a need for that -
|
|
9
|
+
you'll want to check out the [nestable navigation content](/packages/navigation/side-navigation/docs/nestable-navigation-content) component!
|
|
10
|
+
|
|
11
|
+
${code`highlight=1,7,11
|
|
12
|
+
import { NavigationContent } from '@atlaskit/side-navigation';
|
|
13
|
+
|
|
14
|
+
<NavigationHeader label="project">
|
|
15
|
+
<NavigationHeader>
|
|
16
|
+
<Header>Money machine</Header>
|
|
17
|
+
</NavigationHeader>
|
|
18
|
+
<NavigationContent>
|
|
19
|
+
<Section>
|
|
20
|
+
<ButtonItem>Print money</ButtonItem>
|
|
21
|
+
</Section>
|
|
22
|
+
</NavigationContent>
|
|
23
|
+
</NavigationHeader>
|
|
24
|
+
`}
|
|
25
|
+
|
|
26
|
+
${(
|
|
27
|
+
<Example
|
|
28
|
+
title=""
|
|
29
|
+
Component={require('../examples/navigation-content').default}
|
|
30
|
+
source={require('!!raw-loader!../examples/navigation-content')}
|
|
31
|
+
/>
|
|
32
|
+
)}
|
|
33
|
+
|
|
34
|
+
${(
|
|
35
|
+
<Props
|
|
36
|
+
heading="Props"
|
|
37
|
+
props={require('!!extract-react-types-loader!../src/components/NavigationContent')}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
`;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { code, Example, md, Props } from '@atlaskit/docs';
|
|
4
|
+
|
|
5
|
+
export default md`
|
|
6
|
+
Used as the container for navigation items with nested views.
|
|
7
|
+
If you have no need for nested views you'll want to check out the [navigation content](/packages/navigation/side-navigation/docs/navigation-content) component instead!
|
|
8
|
+
|
|
9
|
+
Nested views are enabled by composing [nesting item](/packages/navigation/side-navigation/docs/nesting-item) components inside this one.
|
|
10
|
+
|
|
11
|
+
${code`highlight=1-4,10-11,15-16
|
|
12
|
+
import {
|
|
13
|
+
NestableNavigationContent,
|
|
14
|
+
NestingItem
|
|
15
|
+
} from '@atlaskit/side-navigation';
|
|
16
|
+
|
|
17
|
+
<NavigationHeader label="project">
|
|
18
|
+
<NavigationHeader>
|
|
19
|
+
<Header>Money machine</Header>
|
|
20
|
+
</NavigationHeader>
|
|
21
|
+
<NestableNavigationContent>
|
|
22
|
+
<Section>
|
|
23
|
+
<NestingItem title="Print money">
|
|
24
|
+
<Section>
|
|
25
|
+
<ButtonItem>Money printed</ButtonItem>
|
|
26
|
+
</Section>
|
|
27
|
+
</NestingItem>
|
|
28
|
+
</Section>
|
|
29
|
+
</NestableNavigationContent>
|
|
30
|
+
</NavigationHeader>
|
|
31
|
+
`}
|
|
32
|
+
|
|
33
|
+
${(
|
|
34
|
+
<Example
|
|
35
|
+
title=""
|
|
36
|
+
Component={require('../examples/00-nested-side-navigation').default}
|
|
37
|
+
source={require('!!raw-loader!../examples/00-nested-side-navigation')}
|
|
38
|
+
/>
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
${(
|
|
42
|
+
<Props
|
|
43
|
+
heading="Props"
|
|
44
|
+
props={require('!!extract-react-types-loader!../src/components/NestableNavigationContent')}
|
|
45
|
+
/>
|
|
46
|
+
)}
|
|
47
|
+
|
|
48
|
+
## Custom children
|
|
49
|
+
|
|
50
|
+
Sometimes you'll want to use components that aren't supplied by this library,
|
|
51
|
+
and that's great!
|
|
52
|
+
However you'll need to know that when you do if you don't opt into our "should I render" hook -
|
|
53
|
+
your element will be rendered on _every_ nested view,
|
|
54
|
+
which may or may not be what you want to happen.
|
|
55
|
+
|
|
56
|
+
When writing a leaf node component,
|
|
57
|
+
you'll want to conditionally return \`null\`:
|
|
58
|
+
|
|
59
|
+
${code`
|
|
60
|
+
import { useShouldNestedElementRender } from '@atlaskit/side-navigation';
|
|
61
|
+
|
|
62
|
+
const CustomLeafNode = props => {
|
|
63
|
+
const { shouldRender } = useShouldNestedElementRender();
|
|
64
|
+
if (!shouldRender) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return <div>hello world</div>;
|
|
68
|
+
);
|
|
69
|
+
`}
|
|
70
|
+
|
|
71
|
+
When writing a wrapping component,
|
|
72
|
+
you'll want to conditionally return \`children\`:
|
|
73
|
+
|
|
74
|
+
${code`
|
|
75
|
+
import { useShouldNestedElementRender } from '@atlaskit/side-navigation';
|
|
76
|
+
|
|
77
|
+
const CustomWrapper = props => {
|
|
78
|
+
const { shouldRender } = useShouldNestedElementRender();
|
|
79
|
+
if (!shouldRender) {
|
|
80
|
+
return props.children;
|
|
81
|
+
}
|
|
82
|
+
return <div>{props.children}</div>;
|
|
83
|
+
);
|
|
84
|
+
`}
|
|
85
|
+
|
|
86
|
+
You can see an example of this below.
|
|
87
|
+
|
|
88
|
+
${(
|
|
89
|
+
<Example
|
|
90
|
+
title=""
|
|
91
|
+
Component={require('../examples/custom-nested-children').default}
|
|
92
|
+
source={require('!!raw-loader!../examples/custom-nested-children')}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
95
|
+
`;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { code, Example, md, Props } from '@atlaskit/docs';
|
|
4
|
+
|
|
5
|
+
export default md`
|
|
6
|
+
Footer for the side navigation that is composed of navigation footer and footer components.
|
|
7
|
+
Like the header if you pass an interactive element as the custom component to the footer it will appear interactive.
|
|
8
|
+
|
|
9
|
+
${code`
|
|
10
|
+
import { NavigationFooter, Footer } from '@atlaskit/side-navigation';
|
|
11
|
+
|
|
12
|
+
<NavigationFooter>
|
|
13
|
+
<Footer>My footer</Footer>
|
|
14
|
+
</NavigationFooter>
|
|
15
|
+
`}
|
|
16
|
+
|
|
17
|
+
${(
|
|
18
|
+
<Example
|
|
19
|
+
title=""
|
|
20
|
+
Component={require('../examples/navigation-footer.tsx').default}
|
|
21
|
+
source={require('!!raw-loader!../examples/navigation-footer.tsx')}
|
|
22
|
+
/>
|
|
23
|
+
)}
|
|
24
|
+
|
|
25
|
+
${(
|
|
26
|
+
<Props
|
|
27
|
+
heading="Navigation footer props"
|
|
28
|
+
props={require('!!extract-react-types-loader!../src/components/NavigationFooter')}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
31
|
+
|
|
32
|
+
${(
|
|
33
|
+
<Props
|
|
34
|
+
heading="Footer props"
|
|
35
|
+
props={require('!!extract-react-types-loader!../src/components/Footer')}
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
`;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { code, Example, md, Props } from '@atlaskit/docs';
|
|
4
|
+
|
|
5
|
+
export default md`
|
|
6
|
+
Occasionally you will need to asynchronously load some of your side nav.
|
|
7
|
+
There are a few things to take care of:
|
|
8
|
+
|
|
9
|
+
1. Only use skeletons when you're quite certain of what the loaded state will look like.
|
|
10
|
+
The majority of items that would appear in side navigation are probably fine to use with skeletons,
|
|
11
|
+
for example \`@atlaskit/tree\`
|
|
12
|
+
1. When transitioning from loading skeleton to loaded items try to ensure the jump does not look janky - use the equivalent skeleton item that is appropriate and be careful of things jumping around by a few pixels
|
|
13
|
+
We should be striving for UI that **feels solid**,
|
|
14
|
+
which means it doesn't jump around
|
|
15
|
+
1. Ensure loading does not take _too_ long - try to anticipate if a user will look at your menu via hover events and the like and pre-load the data as soon as you can
|
|
16
|
+
1. When content is loading in make sure it all loads in at once altogether - our minds aren't fast enough to distinguish each item loading individually for example,
|
|
17
|
+
and it would appear slower to the majority of users
|
|
18
|
+
|
|
19
|
+
For a more in-depth look at how to approach loading states have our _work in progress_ [Skeleton exploration](https://hello.atlassian.net/wiki/spaces/ADG/pages/598816601/Loading+experiences+-+3.4+-+Guideline+exploration+-+Skeleton#Exploration-(spec)) (only Atlassians will be able to access this link unfortuntely).
|
|
20
|
+
|
|
21
|
+
${code`highlight=1,9-17,21
|
|
22
|
+
import {
|
|
23
|
+
LoadingItems,
|
|
24
|
+
SectionHeading,
|
|
25
|
+
SkeletonItem
|
|
26
|
+
} from '@atlaskit/side-navigation';
|
|
27
|
+
|
|
28
|
+
<SideNavigation>
|
|
29
|
+
<NavigationContent>
|
|
30
|
+
<LoadingItems
|
|
31
|
+
isLoading={isLoading}
|
|
32
|
+
fallback={
|
|
33
|
+
<>
|
|
34
|
+
<SectionHeading>Project settings</SectionHeading>
|
|
35
|
+
<SkeletonItem />
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<Section title="Project settings">
|
|
40
|
+
<ButtonItem>Details</ButtonItem>
|
|
41
|
+
</Section>
|
|
42
|
+
</LoadingItems>
|
|
43
|
+
<NavigationContent>
|
|
44
|
+
<SideNavigation>
|
|
45
|
+
`}
|
|
46
|
+
|
|
47
|
+
${(
|
|
48
|
+
<Example
|
|
49
|
+
title=""
|
|
50
|
+
Component={require('../examples/07-loading-section.tsx').default}
|
|
51
|
+
source={require('!!raw-loader!../examples/07-loading-section.tsx')}
|
|
52
|
+
/>
|
|
53
|
+
)}
|
|
54
|
+
|
|
55
|
+
${(
|
|
56
|
+
<Props
|
|
57
|
+
heading="Props"
|
|
58
|
+
props={require('!!extract-react-types-loader!../src/components/LoadingItems')}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
|
|
62
|
+
## React Suspense
|
|
63
|
+
|
|
64
|
+
If you're using [Suspense](https://reactjs.org/docs/code-splitting.html#reactlazy) you'll want to use it instead of using the loading items component.
|
|
65
|
+
Unfortunately you won't be able to cross-fade between states,
|
|
66
|
+
but you will simplify your code quite a bit.
|
|
67
|
+
|
|
68
|
+
${code`highlight=1,6-15
|
|
69
|
+
import { Suspense } from 'react';
|
|
70
|
+
import { SectionHeading, SkeletonItem } from '@atlaskit/side-navigation';
|
|
71
|
+
|
|
72
|
+
<SideNavigation>
|
|
73
|
+
<NavigationContent>
|
|
74
|
+
<Suspense
|
|
75
|
+
fallback={
|
|
76
|
+
<>
|
|
77
|
+
<SectionHeading>Project settings</SectionHeading>
|
|
78
|
+
<SkeletonItem />
|
|
79
|
+
</>
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
<LazyItems />
|
|
83
|
+
</Suspense>
|
|
84
|
+
<NavigationContent>
|
|
85
|
+
<SideNavigation>
|
|
86
|
+
`}
|
|
87
|
+
|
|
88
|
+
${(
|
|
89
|
+
<Example
|
|
90
|
+
title=""
|
|
91
|
+
Component={require('../examples/08-suspense-loading-section.tsx').default}
|
|
92
|
+
source={require('!!raw-loader!../examples/08-suspense-loading-section.tsx')}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
95
|
+
`;
|