Skip to content

Commit 28e36cd

Browse files
TheSisbSiTaggart
andauthored
docs(website): add uid-library docs (#885)
* docs(website): add uid-library docs * fix: gatsby file import tidy up and simplify page slugs * docs(website): add headings back to uid docs Co-authored-by: Si Taggart <[email protected]>
1 parent 3c0bfcb commit 28e36cd

File tree

47 files changed

+260
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+260
-67
lines changed

packages/paste-website/gatsby-config.js

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ const gatsbyConfig = {
3131
{
3232
resolve: 'gatsby-source-filesystem',
3333
options: {
34+
// grab stuff in packages for indexing like changelogs, package.json, design token compiled files
3435
name: 'packages',
3536
path: `${__dirname}/../../packages/`,
37+
// but ignore all the build artifacts that we don't need so we don't fill graphql with a bunch of random stuff
3638
ignore: [
3739
'**/.*',
3840
'**/.cache/**',
@@ -42,6 +44,12 @@ const gatsbyConfig = {
4244
'**/__tests__/**',
4345
'**/paste-website/**/*',
4446
'**/README.md',
47+
'**/*.js',
48+
'**/*.ts',
49+
'**/*.tsx',
50+
'**/*.d.ts.map',
51+
'**/*.build.json',
52+
'**/tsconfig.json',
4553
],
4654
},
4755
},
@@ -57,28 +65,6 @@ const gatsbyConfig = {
5765
options: {
5866
name: 'pages',
5967
path: `${__dirname}/src/pages`,
60-
ignore: ['**/components/**/*', '**/primitives/**/*', '**/layout/**/*'],
61-
},
62-
},
63-
{
64-
resolve: 'gatsby-source-filesystem',
65-
options: {
66-
name: 'components',
67-
path: `${__dirname}/src/pages/components`,
68-
},
69-
},
70-
{
71-
resolve: 'gatsby-source-filesystem',
72-
options: {
73-
name: 'primitives',
74-
path: `${__dirname}/src/pages/primitives`,
75-
},
76-
},
77-
{
78-
resolve: 'gatsby-source-filesystem',
79-
options: {
80-
name: 'layout',
81-
path: `${__dirname}/src/pages/layout`,
8268
},
8369
},
8470
{
@@ -141,6 +127,10 @@ const gatsbyConfig = {
141127
return 'PasteLayout';
142128
}
143129

130+
if (node.relativePath.startsWith('paste-libraries') && node.relativePath.endsWith('package.json')) {
131+
return 'PasteLibraries';
132+
}
133+
144134
if (node.relativePath.startsWith('paste-theme') && node.relativePath.endsWith('package.json')) {
145135
return 'PasteThemePackage';
146136
}

packages/paste-website/src/components/shortcodes/component-header/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const getCategoryNameFromRoute = (categoryRoute: string): string => {
1818
return 'Layout';
1919
case SidebarCategoryRoutes.TOKENS:
2020
return 'Tokens';
21+
case SidebarCategoryRoutes.LIBRARIES:
22+
return 'Libraries';
2123
default:
2224
return 'Layout';
2325
}

packages/paste-website/src/components/site-wrapper/sidebar/SidebarAnchor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface SidebarAnchorProps {
88
to: string;
99
}
1010

11-
const StyledSidbarAnchor = styled(Link)<SidebarAnchorProps>`
11+
const StyledSidebarAnchor = styled(Link)<SidebarAnchorProps>`
1212
position: relative;
1313
display: block;
1414
width: 100%;
@@ -39,9 +39,9 @@ const StyledSidbarAnchor = styled(Link)<SidebarAnchorProps>`
3939
`;
4040

4141
const SidebarAnchor: React.FC<SidebarAnchorProps> = ({children, nested, to}) => (
42-
<StyledSidbarAnchor nested={nested} to={to}>
42+
<StyledSidebarAnchor nested={nested} to={to}>
4343
{children}
44-
</StyledSidbarAnchor>
44+
</StyledSidebarAnchor>
4545
);
4646

4747
export {SidebarAnchor};

packages/paste-website/src/components/site-wrapper/sidebar/SidebarNavigation.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ const SidebarNavigation: React.FC<SidebarNavigationProps> = () => {
125125
visible: getCurrentPathname().startsWith(SidebarCategoryRoutes.CONTENT),
126126
});
127127

128+
const librariesDisclosure = useDisclosurePrimitiveState({
129+
visible: getCurrentPathname().startsWith(SidebarCategoryRoutes.LIBRARIES),
130+
});
131+
128132
const tokensDisclosure = useDisclosurePrimitiveState({
129133
visible: getCurrentPathname().startsWith(SidebarCategoryRoutes.TOKENS),
130134
});
@@ -349,7 +353,23 @@ const SidebarNavigation: React.FC<SidebarNavigationProps> = () => {
349353
</DisclosurePrimitiveContent>
350354
</SidebarItem>
351355
<SidebarItem>
352-
<SidebarAnchor to="/libraries">Libraries</SidebarAnchor>
356+
<DisclosurePrimitive as={SidebarDisclosureButton} {...librariesDisclosure} data-cy="libraries-button">
357+
Libraries
358+
</DisclosurePrimitive>
359+
<DisclosurePrimitiveContent {...librariesDisclosure}>
360+
<SidebarNestedList>
361+
<SidebarNestedItem>
362+
<SidebarAnchor nested to={SidebarCategoryRoutes.LIBRARIES}>
363+
Overview
364+
</SidebarAnchor>
365+
</SidebarNestedItem>
366+
<SidebarNestedItem>
367+
<SidebarAnchor nested to={`${SidebarCategoryRoutes.LIBRARIES}/uid-library`}>
368+
UID
369+
</SidebarAnchor>
370+
</SidebarNestedItem>
371+
</SidebarNestedList>
372+
</DisclosurePrimitiveContent>
353373
</SidebarItem>
354374
<SidebarItem>
355375
<SidebarAnchor to="/roadmap">Roadmap</SidebarAnchor>

packages/paste-website/src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const SidebarCategoryRoutes = {
1515
LAYOUT: '/layout',
1616
ICON_SYSTEM: '/icons',
1717
CONTENT: '/content',
18+
LIBRARIES: '/libraries',
1819
GETTING_STARTED: '/getting-started',
1920
TOKENS: '/tokens',
2021
};

packages/paste-website/src/pages/components/alert/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const pageQuery = graphql`
3434
}
3535
}
3636
}
37-
mdx(fields: {slug: {eq: "/alert/"}}) {
37+
mdx(fields: {slug: {eq: "/components/alert/"}}) {
3838
fileAbsolutePath
3939
frontmatter {
4040
slug

packages/paste-website/src/pages/components/anchor/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const pageQuery = graphql`
3333
}
3434
}
3535
}
36-
mdx(fields: {slug: {eq: "/anchor/"}}) {
36+
mdx(fields: {slug: {eq: "/components/anchor/"}}) {
3737
fileAbsolutePath
3838
frontmatter {
3939
slug

packages/paste-website/src/pages/components/avatar/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const pageQuery = graphql`
2727
}
2828
}
2929
}
30-
mdx(fields: {slug: {eq: "/avatar/"}}) {
30+
mdx(fields: {slug: {eq: "/components/avatar/"}}) {
3131
fileAbsolutePath
3232
frontmatter {
3333
slug

packages/paste-website/src/pages/components/button/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const pageQuery = graphql`
2626
}
2727
}
2828
}
29-
mdx(fields: {slug: {eq: "/button/"}}) {
29+
mdx(fields: {slug: {eq: "/components/button/"}}) {
3030
fileAbsolutePath
3131
frontmatter {
3232
slug

packages/paste-website/src/pages/components/card/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const pageQuery = graphql`
6262
}
6363
}
6464
}
65-
mdx(fields: {slug: {eq: "/card/"}}) {
65+
mdx(fields: {slug: {eq: "/components/card/"}}) {
6666
fileAbsolutePath
6767
frontmatter {
6868
slug

0 commit comments

Comments
 (0)