diff --git a/.eslintrc.js b/.eslintrc.js index 65cc11577cbf..1e82ce1151b3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,5 @@ +// @ts-check + const isVSCode = Boolean(process.env.VSCODE_PID) /** @type {import('eslint').Linter.Config} */ @@ -21,7 +23,11 @@ module.exports = { // Only lint the English pages because the Markdown for the other languages is auto-generated from English (via Crowdin). // But include all languages when running the ESLint extension in VS Code (in case the user has "eslint.validate": ["mdx"]), // otherwise there will be random errors since the non-English files don't match any ruleset. - files: [`website/pages/${!isVSCode ? 'en/' : ''}**/*.{md,mdx}`], + files: [`website/src/pages/${isVSCode ? '' : 'en/'}**/*.{md,mdx}`], + excludedFiles: [ + 'website/src/pages/*/subgraphs/developing/creating/graph-ts/*.md', + 'website/src/pages/*/subgraphs/querying/graph-client/*.md', + ], parser: 'eslint-mdx', processor: 'mdx/remark', plugins: ['mdx'], diff --git a/.github/workflows/ci-cd-pull-request.yml b/.github/workflows/ci-cd-pull-request.yml index 8fb9209b7c26..43cb0de5a275 100644 --- a/.github/workflows/ci-cd-pull-request.yml +++ b/.github/workflows/ci-cd-pull-request.yml @@ -19,10 +19,7 @@ jobs: uses: actions/checkout@v4 - name: Set up env - uses: the-guild-org/shared-config/setup@main - with: - nodeVersion: 20 - packageManager: pnpm + uses: the-guild-org/shared-config/setup@v1 - name: Install dependencies run: pnpm install @@ -43,10 +40,7 @@ jobs: uses: actions/checkout@v4 - name: Set up env - uses: the-guild-org/shared-config/setup@main - with: - nodeVersion: 20 - packageManager: pnpm + uses: the-guild-org/shared-config/setup@v1 - name: Install dependencies run: pnpm install @@ -67,10 +61,7 @@ jobs: uses: actions/checkout@v4 - name: Set up env - uses: the-guild-org/shared-config/setup@main - with: - nodeVersion: 20 - packageManager: pnpm + uses: the-guild-org/shared-config/setup@v1 - name: Install dependencies run: pnpm install @@ -92,10 +83,7 @@ jobs: uses: actions/checkout@v4 - name: Set up env - uses: the-guild-org/shared-config/setup@main - with: - nodeVersion: 20 - packageManager: pnpm + uses: the-guild-org/shared-config/setup@v1 - name: Install dependencies run: pnpm install diff --git a/.github/workflows/opengraph.yml b/.github/workflows/opengraph.yml index e62351fb8a05..680e9607621c 100644 --- a/.github/workflows/opengraph.yml +++ b/.github/workflows/opengraph.yml @@ -24,10 +24,7 @@ jobs: ref: ${{ env.COMMIT }} - name: Set up env - uses: the-guild-org/shared-config/setup@main - with: - nodeVersion: 20 - packageManager: pnpm + uses: the-guild-org/shared-config/setup@v1 - name: Deploy working-directory: ./packages/og-image diff --git a/.github/workflows/website-integrity.yml b/.github/workflows/website-integrity.yml index e32925edc4d3..5004eb8685ae 100644 --- a/.github/workflows/website-integrity.yml +++ b/.github/workflows/website-integrity.yml @@ -21,10 +21,7 @@ jobs: run: git fetch origin main - name: Set up env - uses: the-guild-org/shared-config/setup@main - with: - nodeVersion: 20 - packageManager: pnpm + uses: the-guild-org/shared-config/setup@v1 - name: Build Site run: pnpm build diff --git a/.gitignore b/.gitignore index c83bc25bfed4..2ffd990b4054 100644 --- a/.gitignore +++ b/.gitignore @@ -37,5 +37,5 @@ build/ .eslintcache dist/ .turbo/ -packages/og-image/vender/*.wasm +packages/og-image/vendor/*.wasm .wrangler/ diff --git a/.nvmrc b/.nvmrc index 209e3ef4b624..2bd5a0a98a36 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20 +22 diff --git a/.prettierignore b/.prettierignore index 1add30b2f4c6..426402d78110 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,6 @@ out/ pnpm-lock.yaml dist/ -website/remote-files/*.json +# ignore below md since they are fetched from GitHub +website/src/pages/*/subgraphs/developing/creating/graph-ts/*.md +website/src/pages/*/subgraphs/querying/graph-client/*.md diff --git a/.remarkrc.mjs b/.remarkrc.mjs index 08a7ca39f102..0a5307aa0664 100644 --- a/.remarkrc.mjs +++ b/.remarkrc.mjs @@ -1,6 +1,12 @@ +import remarkFrontmatter from 'remark-frontmatter' + +/** + * This config is used by `eslint-plugin-mdx` to lint the MDX files, not by Nextra. + * Nextra uses the remark and rehype plugins registered in `next.config.js`, under `mdxOptions`. + */ export default { plugins: [ - 'frontmatter', // should be defined + remarkFrontmatter, ['remark-lint-first-heading-level', 2], ['remark-lint-restrict-elements', { type: 'heading', depth: 1 }], 'remark-lint-heading-increment', diff --git a/Dockerfile b/Dockerfile index 89e9585af50c..7d6032edbd83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine as builder +FROM node:22-alpine AS builder ARG ENVIRONMENT ARG ORIGIN @@ -14,14 +14,11 @@ RUN corepack enable pnpm WORKDIR /app -COPY . . - -# install the packages -RUN pnpm install --frozen-lockfile --ignore-scripts +COPY . ./ +RUN pnpm install --frozen-lockfile RUN pnpm build -## production environment FROM nginx:1.16.0-alpine COPY --from=builder ./app/nginx.conf /etc/nginx/ diff --git a/README.md b/README.md index 09e69c3a7992..293e73af34ee 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Please read [`CONTRIBUTING.md`](https://github.com/graphprotocol/docs/blob/main/ ## Local Setup -This project is built on [Next.js](https://nextjs.org/). You can run it on your machine, provided you have [Node 20+](https://nodejs.org/en/) and [`pnpm`](https://pnpm.io) installed. +This project is built on [Next.js](https://nextjs.org/). You can run it on your machine, provided you have [Node 22+](https://nodejs.org/en/) and [`pnpm`](https://pnpm.io) installed. First, clone the repo: diff --git a/crowdin.yml b/crowdin.yml index e57e271a1596..fb014a38488f 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,12 +1,10 @@ preserve_hierarchy: 1 files: - - source: /website/pages/en/**/*.mdx - ignore: - - '/website/pages/en/**/\[\[...slug\]\].mdx' - translation: /website/pages/%two_letters_code%/**/%original_file_name% + - source: /website/src/pages/en/**/*.mdx + translation: /website/src/pages/%two_letters_code%/**/%original_file_name% dest: /**/%original_file_name% content_segmentation: 0 - - source: /website/pages/en/**/*.json - translation: /website/pages/%two_letters_code%/**/%original_file_name% + - source: /website/src/pages/en/**/*.json + translation: /website/src/pages/%two_letters_code%/**/%original_file_name% dest: /**/%original_file_name% content_segmentation: 0 diff --git a/nginx.conf b/nginx.conf index bd0a138a7bab..4f324e945255 100644 --- a/nginx.conf +++ b/nginx.conf @@ -33,6 +33,10 @@ http { root /usr/share/nginx/html; index index.html index.htm; + # Short cache with revalidation + add_header Cache-Control "no-cache, must-revalidate"; + expires 5m; + # Redirect `http` to `https` if ($http_x_forwarded_proto = "http") { return 301 https://$host$request_uri; @@ -150,13 +154,11 @@ http { location / { try_files $uri $uri.html $uri/index.html =404; - - add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; - expires -1; } + # Use localized 404 pages for documentation paths location ~ ^/docs/([a-zA-Z][a-zA-Z])/(.*) { - error_page 404 /docs/$1/404/index.html; + try_files $uri $uri.html $uri/index.html /docs/$1/404/index.html; } error_page 500 502 503 504 /docs/50x/index.html; diff --git a/package.json b/package.json index bee38cd4ea91..76f7de158194 100644 --- a/package.json +++ b/package.json @@ -1,34 +1,36 @@ { - "name": "the-graph-docs-monorepo", + "name": "graph-docs", "private": true, - "packageManager": "pnpm@10.1.0", + "version": "1.0.0", + "packageManager": "pnpm@10.3.0", "scripts": { - "dev": "turbo run dev --parallel", + "dev": "turbo run dev", "build": "NODE_OPTIONS='--max_old_space_size=4096' turbo run build", - "docker:build": "source ./website/.env.local && DOCKER_BUILDKIT=1 docker build . -t docs --no-cache --build-arg ENVIRONMENT=$ENVIRONMENT --build-arg ORIGIN=$ORIGIN", - "docker:clean": "docker builder prune", - "docker:up": "docker run --rm -it -p 3000:80 -v \"$(pwd)/nginx.conf:/etc/nginx/nginx.conf\" docs", "check": "pnpm typecheck && pnpm lint && pnpm prettier:check", "check:fix": "pnpm lint:fix; pnpm prettier", + "lint": "eslint . --ignore-path .gitignore --max-warnings 0", + "lint:fix": "eslint . --ignore-path .gitignore --fix", + "prettier": "prettier . --write --list-different", + "prettier:check": "prettier . --check", "typecheck": "turbo run typecheck", - "lint": "eslint . --cache --ignore-path .gitignore --max-warnings 0", - "lint:fix": "eslint . --cache --ignore-path .gitignore --fix; pnpm prettier", - "prettier": "pnpm prettier:check --write", - "prettier:check": "prettier --cache --check .", - "test": "turbo run test" + "test": "turbo run test", + "docker:build": "source ./website/.env.local && DOCKER_BUILDKIT=1 docker build . -t docs --no-cache --build-arg ENVIRONMENT=$ENVIRONMENT --build-arg ORIGIN=$ORIGIN", + "docker:clean": "docker builder prune", + "docker:up": "docker run --rm -it -p 3000:80 -v \"$(pwd)/nginx.conf:/etc/nginx/nginx.conf\" docs" }, "devDependencies": { "@edgeandnode/eslint-config": "^2.0.3", + "@types/node": "^22.13.4", "eslint": "^8.57.1", - "eslint-plugin-mdx": "^2.3.4", - "prettier": "^3.4.2", + "eslint-plugin-mdx": "^3.1.5", + "prettier": "^3.5.1", "prettier-plugin-tailwindcss": "^0.6.11", "remark-frontmatter": "^5.0.0", - "remark-lint-first-heading-level": "^3.1.2", - "remark-lint-heading-increment": "^3.1.2", - "remark-lint-no-heading-punctuation": "^3.1.2", + "remark-lint-first-heading-level": "^4.0.1", + "remark-lint-heading-increment": "^4.0.1", + "remark-lint-no-heading-punctuation": "^4.0.1", "remark-lint-restrict-elements": "workspace:*", - "turbo": "^1.13.4", + "turbo": "^2.4.2", "typescript": "^5.7.3" }, "resolutions": { diff --git a/packages/nextra-theme/package.json b/packages/nextra-theme/package.json deleted file mode 100644 index 9ae5b65550c2..000000000000 --- a/packages/nextra-theme/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@graphprotocol/nextra-theme", - "version": "0.0.0", - "description": "A Nextra theme for The Graph documentation sites.", - "exports": { - ".": { - "import": "./dist/index.js", - "types": "./dist/index.d.mts" - } - }, - "types": "./dist/index.d.mts", - "typesVersions": { - "*": { - ".": [ - "./dist/index.d.mts" - ] - } - }, - "files": [ - "dist" - ], - "scripts": { - "build": "tsup", - "dev": "tsup --watch", - "typecheck": "tsc --noEmit" - }, - "peerDependencies": { - "@edgeandnode/gds": "^6", - "@edgeandnode/go": "^8", - "@emotion/react": "^11", - "next": "^13", - "next-seo": "^6", - "nextra": "^2", - "react-dom": "^18", - "theme-ui": "^0.16" - }, - "dependencies": { - "@docsearch/react": "^3.8.3", - "@radix-ui/react-collapsible": "^1.1.2", - "@radix-ui/react-visually-hidden": "^1.1.1", - "lodash": "^4.17.21", - "react-intersection-observer": "^9.15.1", - "react-use": "^17.6.0" - }, - "devDependencies": { - "@edgeandnode/gds": "^6.2.0", - "@edgeandnode/go": "^8.7.0", - "@emotion/react": "^11.14.0", - "@types/lodash": "^4.17.15", - "@types/react": "^18.3.18", - "@types/react-dom": "^18.3.5", - "next": "^14.2.23", - "next-seo": "^6.6.0", - "nextra": "^2.13.4", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "theme-ui": "^0.17.1", - "tsup": "^8.3.6" - }, - "sideEffects": false -} diff --git a/packages/nextra-theme/src/components/Callout.tsx b/packages/nextra-theme/src/components/Callout.tsx deleted file mode 100644 index d5a396c7f1a8..000000000000 --- a/packages/nextra-theme/src/components/Callout.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { buildBorder, Spacing, Text, type TextProps } from '@edgeandnode/gds' - -export type CalloutProps = Omit - -export const Callout = ({ children, ...props }: CalloutProps) => { - return ( - - {children} - - ) -} diff --git a/packages/nextra-theme/src/components/Code.tsx b/packages/nextra-theme/src/components/Code.tsx deleted file mode 100644 index 7fdaacb1e54c..000000000000 --- a/packages/nextra-theme/src/components/Code.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import type { HTMLAttributes, ReactNode } from 'react' - -import { Code, Spacing } from '@edgeandnode/gds' - -export type CodeBlockProps = { - children?: - | ReactNode - | { - props: { - children: string - className?: string - } - } -} & Omit, 'children'> - -export const CodeBlock = ({ children, ...props }: CodeBlockProps) => { - const code = - children && typeof children === 'object' && 'props' in children - ? children.props.children.trim() - : (children as string) - let language = - children && typeof children === 'object' && 'props' in children - ? children.props.className?.substring('language-'.length) - : null - - if (!language || language === 'sh') { - language = 'bash' - } - - return ( - - {code} - - ) -} - -export const CodeInline = ({ children, ...props }: HTMLAttributes) => { - return {children as string} -} diff --git a/packages/nextra-theme/src/components/Difficulty.tsx b/packages/nextra-theme/src/components/Difficulty.tsx deleted file mode 100644 index 6fc8f0a8425f..000000000000 --- a/packages/nextra-theme/src/components/Difficulty.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { useI18n } from '@edgeandnode/gds' - -// TODO: Refactor this component -export const Difficulty = ({ level }: { level: string }) => { - const { t } = useI18n() - - return ( -
-

- {t('global.technicalLevelRequired')} -

-
-

- {level} -

-
-
- ) -} diff --git a/packages/nextra-theme/src/components/DocSearch.tsx b/packages/nextra-theme/src/components/DocSearch.tsx deleted file mode 100644 index 12dbcc687394..000000000000 --- a/packages/nextra-theme/src/components/DocSearch.tsx +++ /dev/null @@ -1,368 +0,0 @@ -import { DocSearchModal, type DocSearchProps, useDocSearchKeyboardEvents } from '@docsearch/react' -import { keyframes } from '@emotion/react' -import { useCallback, useRef, useState } from 'react' -import { createPortal } from 'react-dom' -import { Global } from 'theme-ui' - -import { - BorderRadius, - BorderWidth, - buildBorder, - buildTransition, - Flex, - FontSize, - FontWeight, - Icon, - LineHeight, - Link, - Opacity, - Responsive, - Spacing, - Text, - useTheme, -} from '@edgeandnode/gds' - -const animationFadeIn = keyframes({ - from: { opacity: 0 }, - to: { opacity: 1 }, -}) - -export function DocSearch(props: DocSearchProps) { - const searchButtonRef = useRef(null) - const [isOpen, setIsOpen] = useState(false) - const [initialQuery, setInitialQuery] = useState(props.initialQuery || undefined) - const { theme } = useTheme() - - const onOpen = useCallback(() => { - setIsOpen(true) - }, [setIsOpen]) - - const onClose = useCallback(() => { - setIsOpen(false) - }, [setIsOpen]) - - const onInput = useCallback( - (event: KeyboardEvent) => { - setIsOpen(true) - setInitialQuery(event.key) - }, - [setIsOpen, setInitialQuery], - ) - - useDocSearchKeyboardEvents({ - isOpen, - onOpen, - onClose, - onInput, - searchButtonRef, - }) - - return ( - <> - - - {(caseName) => { - switch (caseName) { - case 'mobile': - return ( - - - - ) - break - case 'desktop': - return ( - - - - {props.translations?.button?.buttonText ?? 'Search'} - - - - K - - - ) - break - } - }} - - - - {isOpen ? ( - <> - {createPortal( - , - document.body, - )} - ')`, - }, - '.DocSearch-Input': { - p: `${Spacing['32px']} ${Spacing['16px']}`, - outline: 'none', - fontSize: FontSize['18px'], - }, - '.DocSearch-Reset': { - p: 0, - color: 'White48', - transition: buildTransition('COLORS'), - '&:hover': { - color: 'White', - }, - }, - '.DocSearch-Cancel': { - marginInlineStart: Spacing['16px'], - marginInlineEnd: Spacing['4px'], - color: 'inherit', - }, - '.DocSearch-Dropdown': { - maxHeight: ['calc(100vh - 96px)', null, 'max(192px, calc(100vh - 288px))'], - scrollPaddingTop: '32px', - }, - '.DocSearch-Dropdown-Container': { - px: [Spacing['16px'], null, Spacing['32px']], - pt: Spacing['24px'], - pb: [Spacing['64px'], null, Spacing['24px']], - }, - '.DocSearch-Hits': { - width: 'auto', - '& + .DocSearch-Hits': { - mt: Spacing['16px'], - }, - mark: { - color: 'inherit', - textDecoration: 'underline', - }, - }, - '.DocSearch-Hit-source': { - m: 0, - mb: Spacing['2px'], - p: `${Spacing['8px']} ${Spacing['16px']}`, - fontWeight: FontWeight.MEDIUM, - fontSize: FontSize['12px'], - lineHeight: LineHeight.TIGHT, - textTransform: 'uppercase', - letterSpacing: '0.15em', - color: 'White32', - }, - '.DocSearch-Hit': { - p: 0, - a: { - p: `0 ${Spacing['16px']}`, - borderRadius: BorderRadius.S, - }, - '&[aria-selected=true] a': { - bg: 'White8', - }, - }, - '.DocSearch-Hit-Container': { - height: 'auto', - p: `${Spacing['12px']} 0`, - }, - '.DocSearch-Hit-Tree': { - width: Spacing['16px'], - height: 0, - opacity: 0, - }, - '.DocSearch-Hit-icon': { - display: 'none', - }, - '.DocSearch-Hit-content-wrapper': { - m: 0, - }, - '.DocSearch-Hit-title': { - fontSize: FontSize['16px'], - fontWeight: FontWeight.SEMIBOLD, - overflow: 'hidden', - textOverflow: 'ellipsis', - }, - '.DocSearch-Hit-path': { - mt: Spacing['4px'], - fontSize: FontSize['16px'], - fontWeight: FontWeight.REGULAR, - overflow: 'hidden', - textOverflow: 'ellipsis', - }, - '.DocSearch-Hit-action': { - marginInlineStart: Spacing['16px'], - }, - '.DocSearch-HitsFooter': { - display: 'none', - }, - '.DocSearch-Footer': { - position: 'fixed', - bottom: 0, - left: 0, - right: 0, - p: Spacing['16px'], - bg: 'transparent', - boxShadow: 'none', - '&::before': { - display: [null, null, 'none'], - content: `''`, - position: 'absolute', - left: 0, - right: 0, - top: 0, - bottom: 0, - bg: 'var(--docsearch-modal-background)', - opacity: Opacity['88%'], - }, - }, - '.DocSearch-Logo': { - a: { - opacity: Opacity['64%'], - willChange: 'opacity', - transition: buildTransition('OPACITY'), - '&:hover': { - opacity: Opacity['88%'], - }, - }, - }, - '.DocSearch-Commands': { - display: 'none', - }, - '.DocSearch-Screen-Icon': { - p: 0, - mb: Spacing['16px'], - display: 'flex', - justifyContent: 'center', - }, - '.DocSearch-NoResults': { - p: `${Spacing['64px']} 0`, - }, - '.DocSearch-NoResults-Prefill-List': { - p: 0, - mt: Spacing['48px'], - textAlign: 'center', - ul: { - display: 'flex', - flexDirection: 'column', - gap: Spacing['8px'], - li: { - listStyle: 'none', - }, - }, - }, - '.DocSearch-Prefill': { - fontWeight: FontWeight.REGULAR, - }, - }} - /> - - ) : null} - - ) -} diff --git a/packages/nextra-theme/src/components/EditPageLink.tsx b/packages/nextra-theme/src/components/EditPageLink.tsx deleted file mode 100644 index bf864ca33795..000000000000 --- a/packages/nextra-theme/src/components/EditPageLink.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { type HTMLAttributes, useContext } from 'react' - -import { Icon, Link, useI18n } from '@edgeandnode/gds' - -import { NavContext } from '@/layout/NavContext' - -export type EditPageLinkProps = { - mobile?: boolean -} & Omit, 'color' | 'children'> - -export const EditPageLink = ({ mobile = false, ...props }: EditPageLinkProps) => { - const { t } = useI18n() - - // If the current page is in a language other than English, link to the English version, as translations are handled by Crowdin - const { filePath } = useContext(NavContext)! - const [, fileLocale, ...filePathSegments] = filePath.split('/') - const path = filePath.startsWith('https') - ? filePath - : `https://github.com/graphprotocol/docs/blob/main/website/pages/${ - fileLocale && ['en', '[locale]'].includes(fileLocale) ? fileLocale : 'en' - }/${filePathSegments.join('/')}` - return ( - - - {t('global.editPage')} - - ) -} diff --git a/packages/nextra-theme/src/components/Heading.tsx b/packages/nextra-theme/src/components/Heading.tsx deleted file mode 100644 index 00d7d1a4b901..000000000000 --- a/packages/nextra-theme/src/components/Heading.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import * as VisuallyHidden from '@radix-ui/react-visually-hidden' -import { type ElementType, useContext } from 'react' -import { useInView } from 'react-intersection-observer' -import { useDebounce } from 'react-use' - -import { buildTransition, Opacity, Spacing, Text, type TextProps, useI18n } from '@edgeandnode/gds' - -import { LinkInline } from '@/components' -import { DocumentContext } from '@/layout/DocumentContext' - -export type HeadingProps = TextProps & { - level: 1 | 2 | 3 | 4 | 5 | 6 -} - -const BaseHeading = ({ level, id, children, ...props }: HeadingProps) => { - const { markOutlineItem } = useContext(DocumentContext)! - - const { ref, inView: inOrAboveView } = useInView({ - rootMargin: '99999px 0px -80% 0px', // consider it "in or above view" if it's anywhere above 20% from the top of the viewport - }) - - useDebounce( - () => { - if (id) { - markOutlineItem(id, inOrAboveView) - } - }, - 100, - [id, inOrAboveView, markOutlineItem], - ) - - const Heading: ElementType = `h${level}` - - const { t } = useI18n() - - return ( - - {children} - {id ? ( - &, &:focus-within`]: { opacity: Opacity['100%'] }, - transition: buildTransition('OPACITY'), - }} - > - {/* Zero-width non-breaking space, to prevent a line break between the `#` and the previous word */} - ⁠ - - - {t('global.linkToThisSection')} - - - ) : null} - - ) -} - -export type HeadingSpecificProps = Omit - -const H1 = (props: HeadingSpecificProps) => { - return -} - -const H2 = (props: HeadingSpecificProps) => { - return ( - - ) -} - -const H3 = (props: HeadingSpecificProps) => { - return -} - -const H4 = (props: HeadingSpecificProps) => { - return -} - -const H5 = (props: HeadingSpecificProps) => { - return -} - -const H6 = (props: HeadingSpecificProps) => { - return -} - -const Heading = Object.assign({}, BaseHeading, { - H1, - H2, - H3, - H4, - H5, - H6, -}) - -export { Heading } diff --git a/packages/nextra-theme/src/components/Image.tsx b/packages/nextra-theme/src/components/Image.tsx deleted file mode 100644 index ff183bbbaa7d..000000000000 --- a/packages/nextra-theme/src/components/Image.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import type { ImgHTMLAttributes } from 'react' - -export type ImageProps = Omit, 'children'> - -export const Image = ({ src, ...props }: ImageProps) => { - // If the URL is internal, automatically prepend the base path - if (src?.startsWith('/')) { - src = `${process.env.BASE_PATH ?? ''}${src}` - } - - return -} diff --git a/packages/nextra-theme/src/components/Link.tsx b/packages/nextra-theme/src/components/Link.tsx deleted file mode 100644 index 053eae213b28..000000000000 --- a/packages/nextra-theme/src/components/Link.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import type { AnchorHTMLAttributes } from 'react' - -import { Link } from '@edgeandnode/gds' - -export type LinkInlineProps = Omit, 'color' | 'type'> - -export const LinkInline = (props: LinkInlineProps) => { - return -} diff --git a/packages/nextra-theme/src/components/List.tsx b/packages/nextra-theme/src/components/List.tsx deleted file mode 100644 index 0ccbd4e84d0c..000000000000 --- a/packages/nextra-theme/src/components/List.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import type { HTMLAttributes } from 'react' - -import { List, Spacing } from '@edgeandnode/gds' - -export const ListOrdered = (props: HTMLAttributes) => { - return ( - - ) -} - -export const ListUnordered = (props: HTMLAttributes) => { - return ( - - ) -} - -export const ListItem = (props: HTMLAttributes) => { - return -} diff --git a/packages/nextra-theme/src/components/NavTree.tsx b/packages/nextra-theme/src/components/NavTree.tsx deleted file mode 100644 index 1495c53ef2f3..000000000000 --- a/packages/nextra-theme/src/components/NavTree.tsx +++ /dev/null @@ -1,214 +0,0 @@ -import { keyframes } from '@emotion/react' -import * as Collapsible from '@radix-ui/react-collapsible' -import { type AnchorHTMLAttributes, createContext, type HTMLAttributes, useContext, useState } from 'react' -import type { SxProp } from 'theme-ui' - -import { - buildTransition, - Divider, - Flex, - Icon, - type IconProps, - Link, - Spacing, - Text, - type TextProps, - useI18n, -} from '@edgeandnode/gds' - -const animationExpand = keyframes({ - from: { height: 0 }, - to: { height: 'var(--radix-collapsible-content-height)' }, -}) - -const animationCollapse = keyframes({ - from: { height: 'var(--radix-collapsible-content-height)' }, - to: { height: 0 }, -}) - -export type NavTreeProps = HTMLAttributes & { - textProps?: TextProps -} -export type NavTreeItemProps = HTMLAttributes & { - href: NonNullable['href']> - target?: AnchorHTMLAttributes['target'] - active?: boolean - linkProps?: HTMLAttributes & SxProp - diamondProps?: Partial & SxProp -} -export type NavTreeGroupProps = HTMLAttributes & { - active?: boolean -} -export type NavTreeGroupHeadingProps = HTMLAttributes & { - buttonProps?: HTMLAttributes & SxProp -} -export type NavTreeGroupContentProps = HTMLAttributes -export type NavTreeDividerProps = Omit, 'children'> -export type NavTreeHeadingProps = HTMLAttributes - -const NavTree = ({ children, textProps, ...props }: NavTreeProps) => { - return ( - - - {children} - - - ) -} - -const NavTreeItem = ({ - href, - target, - active = false, - children, - linkProps = {}, - diamondProps = {}, - ...props -}: NavTreeItemProps) => { - const { sx: linkSx, ...linkOtherProps } = linkProps - const { sx: diamondSx, ...diamondOtherProps } = diamondProps - return ( -
  • - - {children} - {active ? ( - - ) : null} - -
  • - ) -} - -export const NavTreeGroupContext = createContext({ - active: false, - open: false, -}) - -const NavTreeGroup = ({ active = false, children, ...props }: NavTreeGroupProps) => { - const [open, setOpen] = useState(active) - return ( - -
  • - - {children} - -
  • -
    - ) -} - -const NavTreeGroupHeading = ({ children, buttonProps = {}, ...props }: NavTreeGroupHeadingProps) => { - const { sx: buttonSx, ...buttonOtherProps } = buttonProps - const { open, active } = useContext(NavTreeGroupContext) - const { t } = useI18n() - - return ( -
    - - - {children} - - - - - -
    - ) -} - -const NavTreeGroupContent = ({ children, ...props }: NavTreeGroupContentProps) => { - const context = useContext(NavTreeGroupContext) - return ( - -
      {children}
    -
    - ) -} - -const NavTreeDivider = (props: NavTreeDividerProps) => { - return ( - - ) -} - -const NavTreeHeading = ({ children, ...props }: NavTreeHeadingProps) => { - return ( -
  • - {children} -
  • - ) -} - -NavTree.Item = NavTreeItem -NavTree.Group = NavTreeGroup -NavTreeGroup.Heading = NavTreeGroupHeading -NavTreeGroup.Content = NavTreeGroupContent -NavTree.Divider = NavTreeDivider -NavTree.Heading = NavTreeHeading - -export { NavTree } diff --git a/packages/nextra-theme/src/components/Paragraph.tsx b/packages/nextra-theme/src/components/Paragraph.tsx deleted file mode 100644 index 5c4ccc471982..000000000000 --- a/packages/nextra-theme/src/components/Paragraph.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { Spacing, Text, type TextProps } from '@edgeandnode/gds' - -export type ParagraphProps = Omit - -export const Paragraph = ({ children, ...props }: ParagraphProps) => { - return ( - - {children} - - ) -} diff --git a/packages/nextra-theme/src/components/Table.tsx b/packages/nextra-theme/src/components/Table.tsx deleted file mode 100644 index 87c2e38dc611..000000000000 --- a/packages/nextra-theme/src/components/Table.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import type { TableHTMLAttributes } from 'react' - -import { buildBorder, buildColor, FontWeight, Spacing, Text } from '@edgeandnode/gds' - -export type TableProps = Omit, 'color'> - -export const Table = ({ children, ...props }: TableProps) => { - return ( - - - {children} -
    -
    - ) -} diff --git a/packages/nextra-theme/src/components/VideoEmbed.tsx b/packages/nextra-theme/src/components/VideoEmbed.tsx deleted file mode 100644 index 1e58b30dbaf6..000000000000 --- a/packages/nextra-theme/src/components/VideoEmbed.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { HTMLAttributes } from 'react' - -import { useI18n } from '@edgeandnode/gds' - -export type VideoProps = ( - | { - /** Video embed URL. */ - src: string - youtube?: never - } - | { - /** YouTube video ID. */ - youtube: string - src?: never - } -) & { - /** Video title */ - title?: string -} & HTMLAttributes - -export const VideoEmbed = ({ src, youtube, title, ...props }: VideoProps) => { - const { t } = useI18n() - - return ( -
    -