mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
feat: footer
This commit is contained in:
@@ -1,7 +1,15 @@
|
|||||||
import { Group, Stack, Title, Text, Box, MediaQuery, Aside, ScrollArea } from '@mantine/core';
|
import { Group, Stack, Title, Text, Box, MediaQuery, Aside, ScrollArea } from '@mantine/core';
|
||||||
import { useMediaQuery } from '@mantine/hooks';
|
import { useMediaQuery } from '@mantine/hooks';
|
||||||
import { Fragment, ReactNode } from 'react';
|
import { Fragment, ReactNode } from 'react';
|
||||||
import { VscListSelection, VscSymbolParameter } from 'react-icons/vsc';
|
import {
|
||||||
|
VscSymbolClass,
|
||||||
|
VscSymbolMethod,
|
||||||
|
VscSymbolEnum,
|
||||||
|
VscSymbolInterface,
|
||||||
|
VscSymbolVariable,
|
||||||
|
VscListSelection,
|
||||||
|
VscSymbolParameter,
|
||||||
|
} from 'react-icons/vsc';
|
||||||
import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter';
|
import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter';
|
||||||
import { vscDarkPlus } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
import { vscDarkPlus } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
||||||
import { HyperlinkedText } from './HyperlinkedText';
|
import { HyperlinkedText } from './HyperlinkedText';
|
||||||
@@ -12,7 +20,6 @@ import { TSDoc } from './tsdoc/TSDoc';
|
|||||||
import type { ApiClassJSON, ApiInterfaceJSON, ApiItemJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
import type { ApiClassJSON, ApiInterfaceJSON, ApiItemJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
||||||
import type { TypeParameterData } from '~/DocModel/TypeParameterMixin';
|
import type { TypeParameterData } from '~/DocModel/TypeParameterMixin';
|
||||||
import type { AnyDocNodeJSON } from '~/DocModel/comment/CommentNode';
|
import type { AnyDocNodeJSON } from '~/DocModel/comment/CommentNode';
|
||||||
import { generateIcon } from '~/util/icon';
|
|
||||||
import type { TokenDocumentation } from '~/util/parse.server';
|
import type { TokenDocumentation } from '~/util/parse.server';
|
||||||
|
|
||||||
export interface DocContainerProps {
|
export interface DocContainerProps {
|
||||||
@@ -29,6 +36,19 @@ export interface DocContainerProps {
|
|||||||
properties?: ApiClassJSON['properties'] | ApiInterfaceJSON['properties'] | null;
|
properties?: ApiClassJSON['properties'] | ApiInterfaceJSON['properties'] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateIcon(kind: string) {
|
||||||
|
const icons = {
|
||||||
|
Class: <VscSymbolClass />,
|
||||||
|
Method: <VscSymbolMethod />,
|
||||||
|
Function: <VscSymbolMethod />,
|
||||||
|
Enum: <VscSymbolEnum />,
|
||||||
|
Interface: <VscSymbolInterface />,
|
||||||
|
TypeAlias: <VscSymbolVariable />,
|
||||||
|
};
|
||||||
|
|
||||||
|
return icons[kind as keyof typeof icons];
|
||||||
|
}
|
||||||
|
|
||||||
export function DocContainer({
|
export function DocContainer({
|
||||||
name,
|
name,
|
||||||
kind,
|
kind,
|
||||||
@@ -111,11 +131,14 @@ export function DocContainer({
|
|||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
{(kind === 'Class' || kind === 'Interface') && (methods?.length || properties?.length) ? (
|
{(kind === 'Class' || kind === 'Interface') && (methods?.length || properties?.length) ? (
|
||||||
<MediaQuery smallerThan="md" styles={{ display: 'none' }}>
|
<MediaQuery smallerThan="lg" styles={{ display: 'none' }}>
|
||||||
<Aside
|
<Aside
|
||||||
sx={{ backgroundColor: 'transparent' }}
|
sx={(theme) => ({
|
||||||
hiddenBreakpoint="md"
|
zIndex: 1,
|
||||||
width={{ md: 200, lg: 300 }}
|
background: theme.colorScheme === 'dark' ? theme.colors.dark![8] : theme.colors.gray![0],
|
||||||
|
})}
|
||||||
|
hiddenBreakpoint="lg"
|
||||||
|
width={{ lg: 300 }}
|
||||||
withBorder={false}
|
withBorder={false}
|
||||||
>
|
>
|
||||||
<ScrollArea p="xs">
|
<ScrollArea p="xs">
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ import {
|
|||||||
Menu,
|
Menu,
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
useMantineColorScheme,
|
useMantineColorScheme,
|
||||||
|
Center,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { NextLink } from '@mantine/next';
|
import { NextLink } from '@mantine/next';
|
||||||
import type { MDXRemoteSerializeResult } from 'next-mdx-remote';
|
import type { MDXRemoteSerializeResult } from 'next-mdx-remote';
|
||||||
|
import Image from 'next/future/image';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { type PropsWithChildren, useState } from 'react';
|
import { type PropsWithChildren, useState } from 'react';
|
||||||
@@ -108,16 +110,17 @@ export function SidebarLayout({ packageName, data, children }: PropsWithChildren
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<AppShell
|
<AppShell
|
||||||
styles={{
|
sx={{
|
||||||
main: {
|
main: {
|
||||||
background: theme.colorScheme === 'dark' ? theme.colors.dark![8] : theme.colors.gray![0],
|
background: theme.colorScheme === 'dark' ? theme.colors.dark![8] : theme.colors.gray![0],
|
||||||
overflowX: 'auto',
|
overflowX: 'auto',
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
navbarOffsetBreakpoint="sm"
|
padding={0}
|
||||||
asideOffsetBreakpoint="sm"
|
navbarOffsetBreakpoint="md"
|
||||||
|
asideOffsetBreakpoint="md"
|
||||||
navbar={
|
navbar={
|
||||||
<Navbar hiddenBreakpoint="sm" hidden={!opened} width={{ sm: 200, lg: 300 }}>
|
<Navbar hiddenBreakpoint="md" hidden={!opened} width={{ md: 300 }}>
|
||||||
{packageName && data ? (
|
{packageName && data ? (
|
||||||
<>
|
<>
|
||||||
<Navbar.Section p="xs">
|
<Navbar.Section p="xs">
|
||||||
@@ -164,7 +167,7 @@ export function SidebarLayout({ packageName, data, children }: PropsWithChildren
|
|||||||
<Header height={70} p="md">
|
<Header height={70} p="md">
|
||||||
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', height: '100%' }}>
|
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', height: '100%' }}>
|
||||||
<Box>
|
<Box>
|
||||||
<MediaQuery largerThan="sm" styles={{ display: 'none' }}>
|
<MediaQuery largerThan="md" styles={{ display: 'none' }}>
|
||||||
<Burger
|
<Burger
|
||||||
opened={opened}
|
opened={opened}
|
||||||
onClick={() => setOpened((o) => !o)}
|
onClick={() => setOpened((o) => !o)}
|
||||||
@@ -174,7 +177,7 @@ export function SidebarLayout({ packageName, data, children }: PropsWithChildren
|
|||||||
/>
|
/>
|
||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
|
|
||||||
<MediaQuery smallerThan="sm" styles={{ display: 'none' }}>
|
<MediaQuery smallerThan="md" styles={{ display: 'none' }}>
|
||||||
<Breadcrumbs>{breadcrumbs}</Breadcrumbs>
|
<Breadcrumbs>{breadcrumbs}</Breadcrumbs>
|
||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
</Box>
|
</Box>
|
||||||
@@ -190,7 +193,56 @@ export function SidebarLayout({ packageName, data, children }: PropsWithChildren
|
|||||||
</Header>
|
</Header>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{children}
|
<article>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: 'relative',
|
||||||
|
minHeight: 'calc(100vh - 150px)',
|
||||||
|
zIndex: 1,
|
||||||
|
background: theme.colorScheme === 'dark' ? theme.colors.dark![8] : theme.colors.gray![0],
|
||||||
|
}}
|
||||||
|
p="sm"
|
||||||
|
pb={80}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Box>
|
||||||
|
<Box sx={{ height: 200 }}></Box>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: 'fixed',
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
height: 200,
|
||||||
|
background: theme.colorScheme === 'dark' ? theme.colors.dark![7] : theme.colors.gray![0],
|
||||||
|
paddingLeft: 324,
|
||||||
|
paddingRight: 324,
|
||||||
|
|
||||||
|
[theme.fn.smallerThan('lg')]: {
|
||||||
|
paddingRight: 14,
|
||||||
|
},
|
||||||
|
|
||||||
|
[theme.fn.smallerThan('md')]: {
|
||||||
|
paddingLeft: 24,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
pt={70}
|
||||||
|
>
|
||||||
|
<Center>
|
||||||
|
<Link href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss" passHref>
|
||||||
|
<a title="Vercel">
|
||||||
|
<Image
|
||||||
|
src="/powered-by-vercel.svg"
|
||||||
|
alt="Vercel"
|
||||||
|
width={0}
|
||||||
|
height={0}
|
||||||
|
style={{ height: '100%', width: '100%', maxWidth: 250 }}
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</Center>
|
||||||
|
</Box>
|
||||||
|
</article>
|
||||||
</AppShell>
|
</AppShell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import { VscSymbolClass, VscSymbolMethod, VscSymbolEnum, VscSymbolInterface, VscSymbolVariable } from 'react-icons/vsc';
|
|
||||||
|
|
||||||
export function generateIcon(kind: string) {
|
|
||||||
const icons = {
|
|
||||||
Class: <VscSymbolClass />,
|
|
||||||
Method: <VscSymbolMethod />,
|
|
||||||
Function: <VscSymbolMethod />,
|
|
||||||
Enum: <VscSymbolEnum />,
|
|
||||||
Interface: <VscSymbolInterface />,
|
|
||||||
TypeAlias: <VscSymbolVariable />,
|
|
||||||
};
|
|
||||||
|
|
||||||
return icons[kind as keyof typeof icons];
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user