mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: migrate docs
This commit is contained in:
1 parent
dc37b23727
commit
ea490628fb
15 files changed
+126
-282
No files matched your search
@@ -19,8 +19,6 @@
|
||||
"urlon": "^3.1.0",
|
||||
"react": "^18.3.1",
|
||||
"@vanilla-extract/css": "^1.15.5",
|
||||
"markdown-to-jsx": "^7.5.0",
|
||||
"compare-versions": "^6.1.1",
|
||||
"react-device-detect": "^2.2.3",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-fuzzysort": "^1.0.1",
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { readdir } from 'fs/promises';
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return await readdir('../../docs').then((directories) =>
|
||||
Promise.all(
|
||||
directories
|
||||
.filter(
|
||||
(directory) =>
|
||||
!['.vitepress', 'public'].includes(directory) &&
|
||||
!directory.endsWith('.md'),
|
||||
)
|
||||
.map((directory) =>
|
||||
readdir(`../../docs/${directory}`).then((files) =>
|
||||
Promise.all(
|
||||
files
|
||||
.filter((file) => file.endsWith('.md'))
|
||||
.map((file) => ({
|
||||
directory,
|
||||
document: file.replace(/\.md$/, ''),
|
||||
})),
|
||||
),
|
||||
),
|
||||
),
|
||||
).then((directories) => directories.flat()),
|
||||
);
|
||||
}
|
||||
|
||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
return children;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
import { Table } from '@radix-ui/themes';
|
||||
import Markdown from 'markdown-to-jsx';
|
||||
import { use } from 'react';
|
||||
import { Link } from '../../../../components/Link';
|
||||
import { PageWrapper } from '../../../../components/PageWrapper';
|
||||
|
||||
export default function Page({
|
||||
params,
|
||||
}: {
|
||||
params: { document: string; directory: string };
|
||||
}) {
|
||||
const markdown = use(
|
||||
fetch(
|
||||
`https://raw.githubusercontent.com/tresabhi/blitzkit/${assertSecret(
|
||||
process.env.PUBLIC_ASSET_BRANCH,
|
||||
)}/docs/${params.directory}/${params.document}.md`,
|
||||
).then((response) => response.text()),
|
||||
);
|
||||
const title = markdown.split('\n')[0].replaceAll(/[^a-zA-Z0-9 \.&]/g, '');
|
||||
|
||||
return (
|
||||
<>
|
||||
<title>{title}</title>
|
||||
|
||||
<PageWrapper>
|
||||
<Markdown
|
||||
options={{
|
||||
overrides: {
|
||||
a: { component: Link },
|
||||
table: { component: Table.Root },
|
||||
thead: { component: Table.Header },
|
||||
tbody: { component: Table.Body },
|
||||
tr: { component: Table.Row },
|
||||
th: { component: Table.ColumnHeaderCell },
|
||||
td: { component: Table.Cell },
|
||||
},
|
||||
}}
|
||||
>
|
||||
{markdown}
|
||||
</Markdown>
|
||||
</PageWrapper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
import { Flex, Heading } from '@radix-ui/themes';
|
||||
import { compareVersions } from 'compare-versions';
|
||||
import versions from '../../../../public/assets/versions.json';
|
||||
import { Link } from '../../../components/Link';
|
||||
import { PageWrapper } from '../../../components/PageWrapper';
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<title>BlitzKit - Patch Notes</title>
|
||||
<PageWrapper>
|
||||
<Heading>BlitzKit patch notes</Heading>
|
||||
|
||||
<Flex wrap="wrap" gap="4">
|
||||
{versions
|
||||
.sort(compareVersions)
|
||||
.reverse()
|
||||
.map((version) => {
|
||||
return (
|
||||
<Link key={version} href={`/docs/changelogs/${version}`}>
|
||||
{version}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</Flex>
|
||||
</PageWrapper>{' '}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user