mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
refactor: docs design (#8487)
This commit is contained in:
@@ -2,11 +2,7 @@ import { DocContainer } from '../DocContainer';
|
||||
import { MethodsSection, PropertiesSection } from '../Sections';
|
||||
import type { DocClass } from '~/DocModel/DocClass';
|
||||
|
||||
export interface ClassProps {
|
||||
data: ReturnType<DocClass['toJSON']>;
|
||||
}
|
||||
|
||||
export function Class({ data }: ClassProps) {
|
||||
export function Class({ data }: { data: ReturnType<DocClass['toJSON']> }) {
|
||||
return (
|
||||
<DocContainer
|
||||
name={data.name}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { Stack } from '@mantine/core';
|
||||
import { useMediaQuery } from '@mantine/hooks';
|
||||
import { VscSymbolEnumMember } from 'react-icons/vsc';
|
||||
import { CodeListing, CodeListingSeparatorType } from '../CodeListing';
|
||||
import { DocContainer } from '../DocContainer';
|
||||
import { Section } from '../Section';
|
||||
import type { DocEnum } from '~/DocModel/DocEnum';
|
||||
|
||||
export interface EnumProps {
|
||||
data: ReturnType<DocEnum['toJSON']>;
|
||||
}
|
||||
export function Enum({ data }: { data: ReturnType<DocEnum['toJSON']> }) {
|
||||
const matches = useMediaQuery('(max-width: 768px)', true, { getInitialValueInEffect: false });
|
||||
|
||||
export function Enum({ data }: EnumProps) {
|
||||
return (
|
||||
<DocContainer name={data.name} kind={data.kind} excerpt={data.excerpt} summary={data.summary}>
|
||||
<Section iconElement={<VscSymbolEnumMember />} title="Members" className="dark:text-white">
|
||||
<div className="flex flex-col gap-5">
|
||||
<Section title="Members" icon={<VscSymbolEnumMember />} padded dense={matches}>
|
||||
<Stack>
|
||||
{data.members.map((member) => (
|
||||
<CodeListing
|
||||
key={member.name}
|
||||
@@ -22,7 +22,7 @@ export function Enum({ data }: EnumProps) {
|
||||
summary={member.summary}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</Stack>
|
||||
</Section>
|
||||
</DocContainer>
|
||||
);
|
||||
|
||||
@@ -2,11 +2,7 @@ import { DocContainer } from '../DocContainer';
|
||||
import { ParametersSection } from '../Sections';
|
||||
import type { DocFunction } from '~/DocModel/DocFunction';
|
||||
|
||||
export interface FunctionProps {
|
||||
data: ReturnType<DocFunction['toJSON']>;
|
||||
}
|
||||
|
||||
export function Function({ data }: FunctionProps) {
|
||||
export function Function({ data }: { data: ReturnType<DocFunction['toJSON']> }) {
|
||||
return (
|
||||
<DocContainer
|
||||
name={`${data.name}${data.overloadIndex ? ` (${data.overloadIndex})` : ''}`}
|
||||
|
||||
@@ -2,11 +2,7 @@ import { DocContainer } from '../DocContainer';
|
||||
import { MethodsSection, PropertiesSection } from '../Sections';
|
||||
import type { DocInterface } from '~/DocModel/DocInterface';
|
||||
|
||||
export interface InterfaceProps {
|
||||
data: ReturnType<DocInterface['toJSON']>;
|
||||
}
|
||||
|
||||
export function Interface({ data }: InterfaceProps) {
|
||||
export function Interface({ data }: { data: ReturnType<DocInterface['toJSON']> }) {
|
||||
return (
|
||||
<DocContainer
|
||||
name={data.name}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { DocContainer } from '../DocContainer';
|
||||
import type { DocTypeAlias } from '~/DocModel/DocTypeAlias';
|
||||
|
||||
export interface TypeAliasProps {
|
||||
data: ReturnType<DocTypeAlias['toJSON']>;
|
||||
}
|
||||
|
||||
export function TypeAlias({ data }: TypeAliasProps) {
|
||||
export function TypeAlias({ data }: { data: ReturnType<DocTypeAlias['toJSON']> }) {
|
||||
return (
|
||||
<DocContainer
|
||||
name={data.name}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import { DocContainer } from '../DocContainer';
|
||||
import type { DocVariable } from '~/DocModel/DocVariable';
|
||||
|
||||
export interface VariableProps {
|
||||
data: ReturnType<DocVariable['toJSON']>;
|
||||
}
|
||||
|
||||
export function Variable({ data }: VariableProps) {
|
||||
export function Variable({ data }: { data: ReturnType<DocVariable['toJSON']> }) {
|
||||
return <DocContainer name={data.name} kind={data.kind} excerpt={data.excerpt} summary={data.summary} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user