mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
ci: fix linting astro files
This commit is contained in:
@@ -1,179 +0,0 @@
|
||||
---
|
||||
import { Separator } from 'ariakit/separator';
|
||||
import type { MarkdownLayoutProps } from 'astro';
|
||||
import { ExternalLink } from './ExternalLink.jsx';
|
||||
import { Navbar } from './Navbar.jsx';
|
||||
import { Outline } from './Outline.jsx';
|
||||
import { PageButton } from './PageButton.jsx';
|
||||
import { SidebarItems } from './SidebarItems.jsx';
|
||||
import { generateGithubURL } from '~/util/url.js';
|
||||
|
||||
const pages = await Astro.glob<{ category: string; title: string }>('../pages/**/*.mdx');
|
||||
|
||||
type Props = MarkdownLayoutProps<{}>;
|
||||
const { headings, url, frontmatter } = Astro.props;
|
||||
|
||||
const groupedPages = pages.reduce<Record<string, typeof pages>>((acc, page) => {
|
||||
const { category } = page.frontmatter;
|
||||
acc[category] ??= [];
|
||||
|
||||
acc[category]?.push(page);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// @ts-expect-error props is not typed
|
||||
const category = frontmatter.category as string;
|
||||
|
||||
const curCategoryPages = groupedPages[category];
|
||||
const curCategoryIndex = curCategoryPages!.findIndex((page) => page.url === url);
|
||||
|
||||
const pagePrev = curCategoryPages![curCategoryIndex - 1];
|
||||
const pageNext = curCategoryPages![curCategoryIndex + 1];
|
||||
---
|
||||
|
||||
<script>
|
||||
window.addEventListener('load', () => {
|
||||
const headings = document.querySelectorAll(
|
||||
'div.level-h1 > h1, div.level-h2 > h2, div.level-h3 > h3, div.level-h4 > h4',
|
||||
);
|
||||
|
||||
const headingsObserver = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting) {
|
||||
const location = window.location.toString().split('#')[0];
|
||||
history.replaceState(null, '', location + '#' + entry.target.id);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
root: null,
|
||||
rootMargin: '-100px 0% -66%',
|
||||
threshold: 1.0,
|
||||
},
|
||||
);
|
||||
|
||||
headings.forEach((heading) => headingsObserver.observe(heading));
|
||||
});
|
||||
</script>
|
||||
|
||||
<Navbar client:load>
|
||||
<div class="flex flex-col gap-3 p-3 pb-32 lg:pb-12" slot="pages">
|
||||
<SidebarItems client:load pages={pages} />
|
||||
</div>
|
||||
</Navbar>
|
||||
<main class="pt-18 lg:pl-76 xl:pr-64">
|
||||
<article class="dark:bg-dark-600 bg-light-600">
|
||||
<div class="dark:bg-dark-800 relative z-10 min-h-[calc(100vh_-_70px)] bg-white p-6 pb-20 shadow">
|
||||
<div class="prose max-w-full">
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="h-[calc(100vh - 72px)] dark:bg-dark-600 dark:border-dark-100 border-light-800 fixed top-[72px] right-0 bottom-0 z-20 hidden w-64 border-l bg-white pr-2 xl:block"
|
||||
>
|
||||
<Outline client:load headings={headings} />
|
||||
</div>
|
||||
<Separator className="my-5 border-light-800 dark:border-dark-100" />
|
||||
<div class="flex flex-col space-y-5">
|
||||
<div class="flex place-content-end">
|
||||
<ExternalLink client:load href={generateGithubURL(url!)} title="Edit this page on github" />
|
||||
</div>
|
||||
<div class="flex w-full">
|
||||
{
|
||||
pagePrev && (
|
||||
<PageButton
|
||||
direction="prev"
|
||||
title={pagePrev.frontmatter.title}
|
||||
url={pagePrev.url === '' ? '/' : pagePrev.url!}
|
||||
/>
|
||||
)
|
||||
}
|
||||
<div class="ml-auto self-end justify-self-end">
|
||||
{
|
||||
pageNext && (
|
||||
<PageButton
|
||||
direction="next"
|
||||
title={pageNext.frontmatter.title}
|
||||
url={pageNext.url === '' ? '/' : pageNext.url!}
|
||||
/>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="h-76 md:h-52"></div>
|
||||
<footer
|
||||
class="dark:bg-dark-600 h-76 lg:pl-84 bg-light-600 xl:pr-84 fixed bottom-0 left-0 right-0 md:h-52 md:pl-4 md:pr-16"
|
||||
>
|
||||
<div class="mx-auto flex max-w-6xl flex-col place-items-center gap-12 pt-12 lg:place-content-center">
|
||||
<div class="flex w-full flex-col place-content-between place-items-center gap-12 md:flex-row md:gap-0">
|
||||
<a
|
||||
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
|
||||
href="https://vercel.com/?utm_source=discordjs&utm_campaign=oss"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
title="Vercel"
|
||||
>
|
||||
<img alt="Vercel" src="/powered-by-vercel.svg" />
|
||||
</a>
|
||||
<div class="flex flex-row gap-6 md:gap-12">
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="text-lg font-semibold">Community</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<a
|
||||
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
|
||||
href="https://discord.gg/djs"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
Discord
|
||||
</a>
|
||||
<a
|
||||
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
|
||||
href="https://github.com/discordjs/discord.js/discussions"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
GitHub discussions
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="text-lg font-semibold">Project</div>
|
||||
<div class="flex flex-col gap-1">
|
||||
<a
|
||||
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
|
||||
href="https://github.com/discordjs/discord.js"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
discord.js
|
||||
</a>
|
||||
<a
|
||||
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
|
||||
href="https://discordjs.guide"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
discord.js guide
|
||||
</a>
|
||||
<a
|
||||
class="focus:ring-width-2 focus:ring-blurple rounded outline-0 focus:ring"
|
||||
href="https://discord-api-types.dev"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
discord-api-types
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</article>
|
||||
<div>Test</div>
|
||||
</main>
|
||||
@@ -1,66 +0,0 @@
|
||||
---
|
||||
import '../styles/main.css';
|
||||
import '@code-hike/mdx/styles.css';
|
||||
import '../styles/ch.css';
|
||||
import { inject } from '@vercel/analytics';
|
||||
import type { MarkdownLayoutProps } from 'astro';
|
||||
import SidebarLayout from '../components/SidebarLayout.astro';
|
||||
import { DESCRIPTION } from '../util/constants.js';
|
||||
|
||||
inject();
|
||||
|
||||
type Props = MarkdownLayoutProps<{}>;
|
||||
const props = Astro.props;
|
||||
---
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link href="/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180" />
|
||||
<link href="/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png" />
|
||||
<link href="/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png" />
|
||||
<link href="/site.webmanifest" rel="manifest" />
|
||||
<link color="#090a16" href="/safari-pinned-tab.svg" rel="mask-icon" />
|
||||
<meta content="light dark" name="color-scheme" />
|
||||
<meta content="discord.js" name="apple-mobile-web-app-title" />
|
||||
<meta content="discord.js" name="application-name" />
|
||||
<meta content="#090a16" name="msapplication-TileColor" />
|
||||
<meta content={DESCRIPTION} name="description" />
|
||||
<meta content="discord.js" property="og:site_name" />
|
||||
<meta content="website" property="og:type" />
|
||||
<meta content="discord.js guide" property="og:title" />
|
||||
<meta content={DESCRIPTION} name="og:description" />
|
||||
<meta content="https://discordjs.dev/api/open-graph.png" property="og:image" />
|
||||
<meta content="summary_large_image" name="twitter:card" />
|
||||
<meta content="@iCrawlToGo" name="twitter:creator" />
|
||||
|
||||
<title>discord.js</title>
|
||||
<meta content="minimum-scale=1, initial-scale=1, width=device-width" name="viewport" />
|
||||
<meta content="#5865f2" name="theme-color" />
|
||||
</head>
|
||||
<body class="dark:bg-dark-800 bg-white">
|
||||
<script is:inline>
|
||||
function setTheme(prefersDarkMode, persistedColorPreference) {
|
||||
if (persistedColorPreference === 'dark' || (prefersDarkMode && persistedColorPreference !== 'light')) {
|
||||
document.documentElement.classList.toggle('dark', true);
|
||||
} else {
|
||||
document.documentElement.classList.toggle('dark', false);
|
||||
}
|
||||
}
|
||||
|
||||
(() => {
|
||||
const prefersDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
const persistedColorPreference = localStorage.getItem('theme') || 'auto';
|
||||
setTheme(prefersDarkMode, persistedColorPreference);
|
||||
|
||||
const listener =
|
||||
window.matchMedia &&
|
||||
window
|
||||
.matchMedia('(prefers-color-scheme: dark)')
|
||||
.addEventListener('change', (ev) => setTheme(ev.matches, persistedColorPreference));
|
||||
})();
|
||||
</script>
|
||||
<SidebarLayout {...props}>
|
||||
<slot />
|
||||
</SidebarLayout>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user