mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
feat: use fallback with loading
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Stack } from '@mantine/core';
|
||||
import { Skeleton, Stack } from '@mantine/core';
|
||||
import { useMediaQuery } from '@mantine/hooks';
|
||||
import { useRouter } from 'next/router';
|
||||
import { VscSymbolEnumMember } from 'react-icons/vsc';
|
||||
import { CodeListing, CodeListingSeparatorType } from '../CodeListing';
|
||||
import { DocContainer } from '../DocContainer';
|
||||
@@ -7,23 +8,26 @@ import { Section } from '../Section';
|
||||
import type { ApiEnumJSON } from '~/DocModel/ApiNodeJSONEncoder';
|
||||
|
||||
export function Enum({ data }: { data: ApiEnumJSON }) {
|
||||
const router = useRouter();
|
||||
const matches = useMediaQuery('(max-width: 768px)', true, { getInitialValueInEffect: false });
|
||||
|
||||
return (
|
||||
<DocContainer name={data.name} kind={data.kind} excerpt={data.excerpt} summary={data.summary}>
|
||||
<Section title="Members" icon={<VscSymbolEnumMember size={20} />} padded dense={matches}>
|
||||
<Stack>
|
||||
{data.members.map((member) => (
|
||||
<CodeListing
|
||||
key={member.name}
|
||||
name={member.name}
|
||||
separator={CodeListingSeparatorType.Value}
|
||||
typeTokens={member.initializerTokens}
|
||||
summary={member.summary}
|
||||
/>
|
||||
))}
|
||||
</Stack>
|
||||
</Section>
|
||||
<Skeleton visible={router.isFallback}>
|
||||
<Section title="Members" icon={<VscSymbolEnumMember size={20} />} padded dense={matches}>
|
||||
<Stack>
|
||||
{data.members.map((member) => (
|
||||
<CodeListing
|
||||
key={member.name}
|
||||
name={member.name}
|
||||
separator={CodeListingSeparatorType.Value}
|
||||
typeTokens={member.initializerTokens}
|
||||
summary={member.summary}
|
||||
/>
|
||||
))}
|
||||
</Stack>
|
||||
</Section>
|
||||
</Skeleton>
|
||||
</DocContainer>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user