Skip to content

Commit 91c10c5

Browse files
authored
Next.js + Nextocat documentation (#927)
1 parent c309912 commit 91c10c5

File tree

188 files changed

+21254
-28019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+21254
-28019
lines changed

.changeset/new-tigers-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react-brand': patch
3+
---
4+
5+
Improved typings to various components. This update should not affect the end-user API's.

.github/workflows/deploy_docs_preview.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ jobs:
1717
# SHA for security hardening. Points at 2.1.1 release
1818
uses: primer/.github/.github/workflows/deploy_preview.yml@2a60f4cc62889bd218f3019ce4a090ff89b71cca
1919
with:
20-
node_version: 18
20+
node_version: 20
2121
install: npm ci --legacy-peer-deps && cd apps/docs && npm ci --legacy-peer-deps && cd ..
2222
build: |
23+
export NEXT_PUBLIC_SITE_TITLE='Brand UI'
24+
export NEXT_PUBLIC_REPO='https://github.com/primer/brand'
25+
export NEXT_PUBLIC_REPO_SRC_PATH='app/next-docs'
2326
npm run build && \
24-
npm run build:docs && \
25-
npm run build:storybook && \
2627
mkdir brand-temp && \
2728
mv apps/docs/public/* brand-temp && \
2829
mv brand-temp apps/docs/public/brand && \

.github/workflows/ui_test_accessibility.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
- name: Install dependencies
3333
run: npm ci --legacy-peer-deps && cd apps/docs && npm ci --legacy-peer-deps
3434

35+
- name: Install Playwright
36+
run: npx playwright install
37+
3538
- name: Build dependencies
3639
run: npm run build:lib && cd apps/storybook && npx storybook build
3740

apps/next-docs/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NEXT_PUBLIC_SITE_TITLE = Brand UI
2+
NEXT_PUBLIC_REPO = https://github.com/primer/brand
3+
NEXT_PUBLIC_REPO_SRC_PATH = app/next-docs
4+
NEXT_PUBLIC_PATH_PREFIX =

apps/next-docs/.eslintrc.cjs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports = {
2+
//extends: ['next/core-web-vitals'], // To reenable after upgrading prettier to v3+
3+
parserOptions: {
4+
tsconfigRootDir: __dirname,
5+
},
6+
rules: {
7+
'import/extensions': [
8+
'error',
9+
'ignorePackages',
10+
{
11+
js: 'always',
12+
},
13+
],
14+
'@next/next/no-img-element': 'off',
15+
'primer-react/no-system-props': 'off',
16+
'react/react-in-jsx-scope': 'off', // TODO remove once next/core-web-vitals is reenabled
17+
'react/jsx-no-undef': 'off', // TODO Off due to sideloaded components
18+
'jsx-a11y/html-has-lang': 'off', // Off to suppress false positives in code blocks
19+
'import/extensions': 'off', // TODO reenable once base config is reenabled
20+
'react/no-unescaped-entities': 'off', // TODO reenable once base config is reenabled
21+
'import/no-unresolved': [
22+
'error',
23+
{
24+
ignore: ['^@primer/react-brand'],
25+
},
26+
],
27+
},
28+
}

apps/next-docs/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.next/
2+
out/
3+
*.tsbuildinfo
4+
!.env
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import {generateStaticParamsFor, importPage} from '@primer/doctocat-nextjs'
2+
import {useMDXComponents as getMDXComponents} from '../../mdx-components.js'
3+
4+
export const generateStaticParams = generateStaticParamsFor('mdxPath')
5+
6+
type Props = {
7+
params: Promise<{
8+
mdxPath: string[]
9+
}>
10+
}
11+
export async function generateMetadata(props: Props) {
12+
const params = await props.params
13+
const {metadata} = await importPage(params.mdxPath)
14+
return metadata
15+
}
16+
17+
const {Article: Wrapper} = getMDXComponents()
18+
19+
export default async function Page(props: Props) {
20+
const params = await props.params
21+
const result = await importPage(params.mdxPath)
22+
const {default: MDXContent, toc, metadata} = result
23+
24+
return (
25+
<Wrapper toc={toc} metadata={metadata}>
26+
<MDXContent {...props} params={params} />
27+
</Wrapper>
28+
)
29+
}

apps/next-docs/app/_meta.global.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// eslint-disable-next-line filenames/match-regex
2+
export default {
3+
github: {
4+
type: 'page',
5+
href: 'https://github.com/primer/brand',
6+
title: 'GitHub',
7+
},
8+
product: {
9+
type: 'page',
10+
href: 'https://primer.style',
11+
title: 'Product UI',
12+
},
13+
toolkit: {
14+
type: 'page',
15+
href: 'https://brand.github.com',
16+
title: 'Brand Toolkit',
17+
},
18+
octicons: {
19+
type: 'page',
20+
href: 'https://primer.style/octicons',
21+
title: 'Octicons',
22+
},
23+
}

apps/next-docs/app/favicon-16x16.png

465 Bytes
Loading

apps/next-docs/app/favicon-32x32.png

827 Bytes
Loading

0 commit comments

Comments
 (0)