feat: packages route

This commit is contained in:
iCrawl
2022-08-22 16:01:42 +02:00
parent 191951ac28
commit 1aec243b1d
3 changed files with 46 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ const useStyles = createStyles((theme, { opened }: { opened: boolean }) => ({
control: {
display: 'block',
width: '100%',
padding: `${theme.spacing.xs}px ${theme.spacing.xs}px`,
padding: theme.spacing.xs,
color: theme.colorScheme === 'dark' ? theme.colors.dark![0] : theme.black,
'&:hover': {

View File

@@ -6,5 +6,5 @@ export default function middleware(request: NextRequest) {
}
export const config = {
matcher: ['/docs', '/docs/:branch', '/docs/:branch/packages'],
matcher: ['/docs', '/docs/:branch'],
};

View File

@@ -0,0 +1,44 @@
import { Container, UnstyledButton, createStyles, Group, ThemeIcon, Text, Stack } from '@mantine/core';
import Link from 'next/link';
import { VscArrowRight, VscPackage } from 'react-icons/vsc';
const useStyles = createStyles((theme) => ({
control: {
padding: theme.spacing.xs,
color: theme.colorScheme === 'dark' ? theme.colors.dark![0] : theme.black,
'&:hover': {
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark![6] : theme.colors.gray![0],
color: theme.colorScheme === 'dark' ? theme.white : theme.black,
},
},
}));
export default function PackagesRoute() {
const { classes } = useStyles();
const packages = ['builders', 'collection', 'proxy', 'rest', 'voice', 'ws'];
return (
<Container pt={96} size="xs">
<Stack sx={{ flexGrow: 1 }}>
{packages.map((pkg) => (
<Link key={pkg} href={`/docs/main/packages/${pkg}`} passHref>
<UnstyledButton className={classes.control} component="a">
<Group position="apart">
<Group>
<ThemeIcon size={30}>
<VscPackage />
</ThemeIcon>
<Text weight={600} size="md">
{pkg}
</Text>
</Group>
<VscArrowRight size={20} />
</Group>
</UnstyledButton>
</Link>
))}
</Stack>
</Container>
);
}