diff --git a/website/src/components/LeftSidebar/LeftSidebar.astro b/website/src/components/LeftSidebar/LeftSidebar.astro index b3f69a7e1..5272ee546 100644 --- a/website/src/components/LeftSidebar/LeftSidebar.astro +++ b/website/src/components/LeftSidebar/LeftSidebar.astro @@ -43,6 +43,9 @@ const sidebar = SIDEBAR[langCode]; )) } +
  • + Reference +
  • diff --git a/website/src/components/LeftSidebar/ReferenceSidebar.astro b/website/src/components/LeftSidebar/ReferenceSidebar.astro new file mode 100644 index 000000000..24551388c --- /dev/null +++ b/website/src/components/LeftSidebar/ReferenceSidebar.astro @@ -0,0 +1,60 @@ +--- +import { docs } from '../../../../doc.json'; + +type Props = { + currentPage: string; +}; + +const { currentPage } = Astro.props as Props; +const { BASE_URL } = import.meta.env; +let currentPageMatch = currentPage.slice(BASE_URL.length, currentPage.endsWith('/') ? -1 : undefined); +--- + + + + diff --git a/website/src/config.ts b/website/src/config.ts index ba9b06667..50c525be7 100644 --- a/website/src/config.ts +++ b/website/src/config.ts @@ -15,7 +15,7 @@ export const OPEN_GRAPH = { export type Frontmatter = { title: string; description: string; - layout: string; + layout?: string; image?: { src: string; alt: string }; dir?: 'ltr' | 'rtl'; ogLocale?: string; diff --git a/website/src/layouts/ReferenceLayout.astro b/website/src/layouts/ReferenceLayout.astro new file mode 100644 index 000000000..71a12004d --- /dev/null +++ b/website/src/layouts/ReferenceLayout.astro @@ -0,0 +1,50 @@ +--- +import HeadCommon from '../components/HeadCommon.astro'; +import HeadSEO from '../components/HeadSEO.astro'; +import Header from '../components/Header/Header.astro'; +import PageContent from '../components/PageContent/PageContent.astro'; +import RightSidebar from '../components/RightSidebar/RightSidebar.astro'; +import * as CONFIG from '../config'; +import type { MarkdownHeading } from 'astro'; +import '../docs/docs.css'; +import ReferenceSidebar from '../components/LeftSidebar/ReferenceSidebar.astro'; + +type Props = { + frontmatter: CONFIG.Frontmatter; + headings: MarkdownHeading[]; +}; + +const { frontmatter, headings } = Astro.props as Props; +const canonicalURL = new URL(Astro.url.pathname, Astro.site); +const currentPage = Astro.url.pathname; +const currentFile = `src/pages${currentPage.replace(/\/$/, '')}.mdx`; +const githubEditUrl = `${CONFIG.GITHUB_EDIT_URL}/${currentFile}`; +--- + + + + + + + {frontmatter.title ? `${frontmatter.title} 🌀 ${CONFIG.SITE.title}` : CONFIG.SITE.title} + + + + +
    +
    +
    +
    +
    +
    + + + + +
    +
    +
    + + diff --git a/website/src/pages/ref/[ref].astro b/website/src/pages/ref/[ref].astro new file mode 100644 index 000000000..b86314734 --- /dev/null +++ b/website/src/pages/ref/[ref].astro @@ -0,0 +1,20 @@ +--- +import ReferenceLayout from '../../layouts/ReferenceLayout.astro'; +import { docs } from '../../../../doc.json'; +import JsDoc from '../../docs/JsDoc.astro'; + +export function getStaticPaths() { + return docs.map((doc) => [{ params: { ref: doc.longname } }]); +} + +const { ref } = Astro.params; +const entry = docs.find((d) => d.longname === ref); +if (!entry) { + return; +} +--- + + +

    {entry!.name}

    + +
    diff --git a/website/src/pages/ref/index.astro b/website/src/pages/ref/index.astro new file mode 100644 index 000000000..816446b9c --- /dev/null +++ b/website/src/pages/ref/index.astro @@ -0,0 +1,8 @@ +--- +import ReferenceLayout from '../../layouts/ReferenceLayout.astro'; +--- + + +

    Reference

    +

    Welcome to the Reference! Pick an Item on the left

    +