mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
refactor: use next links (#8344)
* chore(website): use next links * chore: fix deploy check * chore: use ligher syntax highlighter
This commit is contained in:
2
.github/check_deploy_branch.sh
vendored
2
.github/check_deploy_branch.sh
vendored
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
git diff HEAD^ HEAD --quiet .
|
git diff HEAD^ HEAD --quiet .
|
||||||
|
|
||||||
if [[ "$VERCEL_GIT_COMMIT_REF" == "main" && $? -eq 1 ]]; then
|
if [[ "$VERCEL_GIT_COMMIT_REF" == "main" || $? -eq 1 ]]; then
|
||||||
# Proceed with the build
|
# Proceed with the build
|
||||||
echo "✅ - Proceed"
|
echo "✅ - Proceed"
|
||||||
exit 1;
|
exit 1;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { Prism 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';
|
||||||
import { Section } from './Section';
|
import { Section } from './Section';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
import type { TokenDocumentation } from '~/util/parse.server';
|
import type { TokenDocumentation } from '~/util/parse.server';
|
||||||
|
|
||||||
export interface HyperlinkedTextProps {
|
export interface HyperlinkedTextProps {
|
||||||
@@ -17,9 +18,9 @@ export function HyperlinkedText({ tokens }: HyperlinkedTextProps) {
|
|||||||
{tokens.map((token) => {
|
{tokens.map((token) => {
|
||||||
if (token.path) {
|
if (token.path) {
|
||||||
return (
|
return (
|
||||||
<a key={token.text} href={token.path}>
|
<Link key={token.text} href={token.path}>
|
||||||
{token.text}
|
{token.text}
|
||||||
</a>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import Link from 'next/link';
|
||||||
import { FiMenu } from 'react-icons/fi';
|
import { FiMenu } from 'react-icons/fi';
|
||||||
import { VscPackage } from 'react-icons/vsc';
|
import { VscPackage } from 'react-icons/vsc';
|
||||||
import { generateIcon } from '~/util/icon';
|
import { generateIcon } from '~/util/icon';
|
||||||
@@ -18,7 +19,7 @@ function onMenuClick() {
|
|||||||
export function ItemSidebar({ packageName, data }: ItemListProps) {
|
export function ItemSidebar({ packageName, data }: ItemListProps) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col max-h-full min-w-[270px] lg:border-r-solid border-b-solid border-gray border-width-0.5">
|
<div className="flex flex-col max-h-full min-w-[270px] lg:border-r-solid border-b-solid border-gray border-width-0.5">
|
||||||
<div className="flex justify-between items-center border-b-solid border-gray border-width-0.5 py-2">
|
<div className=" border-b-solid border-gray border-width-0.5 py-2 sticky top-0">
|
||||||
<h2 className="px-2 font-mono flex items-center m-0 dark:text-white">
|
<h2 className="px-2 font-mono flex items-center m-0 dark:text-white">
|
||||||
<VscPackage className="px-1" />
|
<VscPackage className="px-1" />
|
||||||
{`${packageName}`}
|
{`${packageName}`}
|
||||||
@@ -30,13 +31,10 @@ export function ItemSidebar({ packageName, data }: ItemListProps) {
|
|||||||
<div className="hidden lg:block lg:min-h-screen overflow-y-scroll overflow-x-clip p-7">
|
<div className="hidden lg:block lg:min-h-screen overflow-y-scroll overflow-x-clip p-7">
|
||||||
{data.members.map((member, i) => (
|
{data.members.map((member, i) => (
|
||||||
<div key={i} className="mb-1">
|
<div key={i} className="mb-1">
|
||||||
<a
|
<div className="flex items-center align-center font-mono no-underline break-all text-blue-500 dark:text-blue-300">
|
||||||
className="flex items-center align-center font-mono no-underline break-all text-blue-500 dark:text-blue-300"
|
|
||||||
href={member.path}
|
|
||||||
>
|
|
||||||
{generateIcon(member.kind, 'px-1')}
|
{generateIcon(member.kind, 'px-1')}
|
||||||
{member.name}
|
<Link href={member.path}>{member.name}</Link>
|
||||||
</a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,21 @@ import type { AppProps } from 'next/app';
|
|||||||
import '@unocss/reset/normalize.css';
|
import '@unocss/reset/normalize.css';
|
||||||
import '../styles/unocss.css';
|
import '../styles/unocss.css';
|
||||||
import '../styles/main.css';
|
import '../styles/main.css';
|
||||||
|
import { ItemSidebar } from '~/components/ItemSidebar';
|
||||||
|
|
||||||
export default function MyApp({ Component, pageProps }: AppProps) {
|
export default function MyApp({ Component, pageProps }: AppProps) {
|
||||||
return <Component {...pageProps} />;
|
return (
|
||||||
|
<div className="flex flex-col lg:flex-row overflow-hidden max-w-full h-full max-h-full bg-white dark:bg-dark">
|
||||||
|
<div className="w-full lg:max-w-1/4 lg:min-w-1/4">
|
||||||
|
{/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */}
|
||||||
|
{pageProps.packageName && pageProps.data ? (
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
||||||
|
<ItemSidebar packageName={pageProps.packageName} data={pageProps.data} />
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
<div className="max-h-full grow overflow-auto">
|
||||||
|
<Component {...pageProps} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type { DocFunction } from '~/DocModel/DocFunction';
|
|||||||
import type { DocInterface } from '~/DocModel/DocInterface';
|
import type { DocInterface } from '~/DocModel/DocInterface';
|
||||||
import type { DocTypeAlias } from '~/DocModel/DocTypeAlias';
|
import type { DocTypeAlias } from '~/DocModel/DocTypeAlias';
|
||||||
import type { DocVariable } from '~/DocModel/DocVariable';
|
import type { DocVariable } from '~/DocModel/DocVariable';
|
||||||
import { ItemSidebar, type ItemListProps } from '~/components/ItemSidebar';
|
import type { ItemListProps } from '~/components/ItemSidebar';
|
||||||
import { Class } from '~/components/model/Class';
|
import { Class } from '~/components/model/Class';
|
||||||
import { Enum } from '~/components/model/Enum';
|
import { Enum } from '~/components/model/Enum';
|
||||||
import { Function } from '~/components/model/Function';
|
import { Function } from '~/components/model/Function';
|
||||||
@@ -106,12 +106,7 @@ export default function Slug(
|
|||||||
) {
|
) {
|
||||||
return props.error ? (
|
return props.error ? (
|
||||||
<div className="flex max-w-full h-full bg-white dark:bg-dark">{props.error}</div>
|
<div className="flex max-w-full h-full bg-white dark:bg-dark">{props.error}</div>
|
||||||
) : (
|
) : props.data?.member ? (
|
||||||
<div className="flex flex-col lg:flex-row overflow-hidden max-w-full h-full bg-white dark:bg-dark">
|
member(props.data.member)
|
||||||
<div className="w-full lg:min-w-1/4 lg:max-w-1/4">
|
) : null;
|
||||||
{props.packageName && props.data ? <ItemSidebar packageName={props.packageName} data={props.data} /> : null}
|
|
||||||
</div>
|
|
||||||
<div className="max-h-full grow overflow-auto">{props.data?.member ? member(props.data.member) : null}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user