Skip to content

Commit ae8568f

Browse files
committed
feat(website): add docs/components/[...slug] page
1 parent 4a25717 commit ae8568f

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
import { getCollection, render } from 'astro:content';
3+
import { DocsLayout } from '@/layouts/docs-layout';
4+
import { MDXComponents } from '@/ui/mdx/mdx-components';
5+
import { DocsNav } from '@/components/docs-nav';
6+
import { TableOfContents } from '@/components/table-of-contents';
7+
8+
export const getStaticPaths = async () => {
9+
const docsEntries = await getCollection('componentsContent');
10+
11+
return docsEntries.map((entry) => ({
12+
params: { slug: entry.id },
13+
props: { entry },
14+
}));
15+
};
16+
17+
const { entry } = Astro.props;
18+
const { Content, headings } = await render(entry);
19+
---
20+
21+
<DocsLayout.Root>
22+
<DocsLayout.Head />
23+
<DocsLayout.Body>
24+
<DocsLayout.Content>
25+
<DocsLayout.DocsNavAsideContainer>
26+
<DocsLayout.DocsNavAside>
27+
<DocsNav variant="desktop" />
28+
</DocsLayout.DocsNavAside>
29+
</DocsLayout.DocsNavAsideContainer>
30+
31+
<DocsLayout.Main>
32+
<DocsLayout.Article>
33+
<Content components={MDXComponents} />
34+
</DocsLayout.Article>
35+
</DocsLayout.Main>
36+
37+
<DocsLayout.TableOfContentsAsideContainer>
38+
<DocsLayout.TableOfContentsAside>
39+
<TableOfContents headings={headings} />
40+
</DocsLayout.TableOfContentsAside>
41+
</DocsLayout.TableOfContentsAsideContainer>
42+
</DocsLayout.Content>
43+
</DocsLayout.Body>
44+
</DocsLayout.Root>

0 commit comments

Comments
 (0)