feat: move docs up

This commit is contained in:
tresabhi committed 2025-01-07 13:12:22 -06:00
1 parent 571ae81306
commit 65899a06c4
4 files changed
+8 -9

No files matched your search

@@ -1,14 +0,0 @@
import { Markdown } from '../../../../../components/Markdown';
import { PageWrapper } from '../../../../../components/PageWrapper';
interface PageProps {
content: string;
}
export function Page({ content }: PageProps) {
return (
<PageWrapper>
<Markdown>{content}</Markdown>
</PageWrapper>
);
}
@@ -1,38 +0,0 @@
---
import type { GetStaticPaths } from 'astro';
import { readFile } from 'fs/promises';
import BaseLayout from '../../../../../layouts/BaseLayout.astro';
import { Page } from './_index';
export const getStaticPaths = (async () => {
const ROOT = '../../../../../../../docs/';
const files = import.meta.glob('../../../../../../../docs/**/*.md', {
eager: true,
});
return await Promise.all(
Object.keys(files).map(async (file) => {
const couple = file.replace(ROOT, '').split('/');
couple[1] = couple[1].replace('.md', '');
const content = await readFile(
`../../docs/${couple[0]}/${couple[1]}.md`,
).then((buffer) => buffer.toString());
return {
params: { directory: couple[0], document: couple[1] },
props: { content },
};
}),
);
}) satisfies GetStaticPaths;
const { content } = Astro.props;
const title = content.split('\n')[0].replace('# ', '');
---
<title>{title}</title>
<BaseLayout>
<Page content={content} />
</BaseLayout>
@@ -1,53 +0,0 @@
---
import { MagicWandIcon, StarFilledIcon } from '@radix-ui/react-icons';
import { Flex, Heading } from '@radix-ui/themes';
import { compareVersions } from 'compare-versions';
import { LinkI18n } from '../../../../components/LinkI18n';
import { PageWrapper } from '../../../../components/PageWrapper';
import BaseLayout from '../../../../layouts/BaseLayout.astro';
// this can't be used in template literal :(
const ROOT = '../../../../../../docs/changelogs/';
const versions = Object.keys(
import.meta.glob(`../../../../../../docs/changelogs/*.md`, {
eager: true,
}),
)
.map((file) => file.replace(ROOT, '').replace('.md', ''))
.sort(compareVersions)
.reverse();
const { locale } = Astro.params;
---
<title>BlitzKit Patches</title>
<BaseLayout>
<PageWrapper align="center">
<Heading mt="6" mb="4">BlitzKit patches</Heading>
<Flex direction="column" gap="2" align="center">
{
versions.map((version) => {
const split = version.split('.').map(Number);
const isMajor = split[2] === 0;
return (
<LinkI18n
{locale}
size="5"
href={`/docs/changelogs/${version}`}
mb={isMajor ? '6' : '0'}
>
<Flex align="center" gap="2">
{!isMajor && <MagicWandIcon />}
{isMajor && <StarFilledIcon />}
{version}
</Flex>
</LinkI18n>
);
})
}
</Flex>
</PageWrapper>
</BaseLayout>