-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
94 changed files
with
386 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Metadata } from 'next'; | ||
|
||
import { notFound } from 'next/navigation'; | ||
import { DocPage } from '../../../components/doc-page'; | ||
import { transformMarkdoc } from '../../../utils/markdoc'; | ||
import { reader } from '../../../utils/packages'; | ||
|
||
export async function generateStaticParams() { | ||
const entries = await reader.collections.otherDocs.list(); | ||
|
||
return entries.map(slug => { | ||
const split = slug.split('/'); | ||
return { | ||
slug: split[split.length - 1] === 'index' ? split.slice(0, -1) : split, | ||
}; | ||
}); | ||
} | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: { | ||
params: { slug?: string[] }; | ||
}): Promise<Metadata> { | ||
const slug = (params.slug ?? ['index']).join('/'); | ||
let entry = await reader.collections.otherDocs.read(slug); | ||
if (!entry && slug !== 'index') { | ||
entry = await reader.collections.otherDocs.read(slug + '/index'); | ||
} | ||
if (!entry) notFound(); | ||
return { title: entry.title }; | ||
} | ||
|
||
export default async function Page(props: { params: { slug?: string[] } }) { | ||
const slug = (props.params.slug ?? ['index']).join('/'); | ||
let entry = await reader.collections.otherDocs.read(slug, { | ||
resolveLinkedFiles: true, | ||
}); | ||
if (!entry && slug !== 'index') { | ||
entry = await reader.collections.otherDocs.read(slug + '/index', { | ||
resolveLinkedFiles: true, | ||
}); | ||
} | ||
if (!entry) notFound(); | ||
|
||
const content = transformMarkdoc(slug, entry?.content.node); | ||
|
||
return ( | ||
<DocPage | ||
content={content} | ||
title={entry.title} | ||
description={entry.description} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
design-system/docs/app/not-found.tsx → design-system/docs/app/(site)/not-found.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
design-system/docs/app/(site)/package/[package]/[[...slug]]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Metadata } from 'next'; | ||
|
||
import { notFound } from 'next/navigation'; | ||
import { DocPage } from '../../../../../components/doc-page'; | ||
import { transformMarkdoc } from '../../../../../utils/markdoc'; | ||
import { reader } from '../../../../../utils/packages'; | ||
|
||
export async function generateStaticParams() { | ||
const entries = await reader.collections.packageDocs.list(); | ||
return entries.map(slug => { | ||
const split = slug.split('/').filter(x => x !== 'docs'); | ||
return { | ||
slug: split[split.length - 1] === 'index' ? split.slice(0, -1) : split, | ||
}; | ||
}); | ||
} | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: { | ||
params: { slug?: string[] }; | ||
}): Promise<Metadata> { | ||
const slug = (params.slug ?? ['index']).join('/'); | ||
let entry = await reader.collections.packageDocs.read(slug); | ||
if (!entry && slug !== 'index') { | ||
entry = await reader.collections.packageDocs.read(slug + '/index'); | ||
} | ||
if (!entry) notFound(); | ||
return { title: entry.title }; | ||
} | ||
|
||
export default async function Page(props: { params: { slug?: string[] } }) { | ||
if (!props.params.slug) notFound(); | ||
|
||
const slugWithDocsBitAdded = [ | ||
...props.params.slug[0], | ||
'docs', | ||
...props.params.slug.slice(1), | ||
]; | ||
const slug = slugWithDocsBitAdded.join('/'); | ||
let entry = await reader.collections.packageDocs.read(slug, { | ||
resolveLinkedFiles: true, | ||
}); | ||
if (!entry && slug !== 'index') { | ||
entry = await reader.collections.packageDocs.read(slug + '/index', { | ||
resolveLinkedFiles: true, | ||
}); | ||
} | ||
if (!entry) notFound(); | ||
|
||
const content = transformMarkdoc(slug, entry?.content.node); | ||
|
||
return ( | ||
<DocPage | ||
content={content} | ||
title={entry.title} | ||
description={entry.description} | ||
/> | ||
); | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import localConfig from '../../../../keystatic.config'; | ||
import { makeRouteHandler } from '@keystatic/next/route-handler'; | ||
|
||
export const { POST, GET } = makeRouteHandler({ | ||
config: localConfig, | ||
localBaseDirectory: '../..', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Page() { | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use client'; | ||
|
||
import { makePage } from '@keystatic/next/ui/app'; | ||
import localConfig from '../../keystatic.config'; | ||
|
||
export default makePage(localConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import KeystaticApp from './keystatic'; | ||
|
||
export const metadata = { | ||
title: 'Keystatic', | ||
}; | ||
|
||
export default function RootLayout() { | ||
return ( | ||
<html> | ||
<head /> | ||
<body> | ||
<KeystaticApp /> | ||
</body> | ||
</html> | ||
); | ||
} |
48 changes: 0 additions & 48 deletions
48
design-system/docs/app/package/[package]/[[...slug]]/page.tsx
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { collection, config, fields } from '@keystatic/core'; | ||
import { categories } from './utils/categories'; | ||
|
||
export default config({ | ||
storage: { kind: process.env.NODE_ENV === 'production' ? 'cloud' : 'local' }, | ||
cloud: { | ||
project: 'thinkmill-labs/keystar-ui', | ||
}, | ||
collections: { | ||
packageDocs: collection({ | ||
label: 'Package Docs', | ||
path: 'design-system/pkg/src/**', | ||
slugField: 'title', | ||
entryLayout: 'content', | ||
format: { contentField: 'content' }, | ||
schema: { | ||
title: fields.slug({ name: { label: 'Title' } }), | ||
description: fields.text({ label: 'Description', multiline: true }), | ||
category: fields.select({ | ||
label: 'Category', | ||
options: categories.map(category => ({ | ||
label: category, | ||
value: category, | ||
})), | ||
defaultValue: 'Introduction', | ||
}), | ||
content: fields.markdoc({ | ||
label: 'Content', | ||
options: { | ||
codeBlock: { | ||
schema: { | ||
live: fields.checkbox({ label: 'Live' }), | ||
}, | ||
}, | ||
}, | ||
}), | ||
}, | ||
}), | ||
otherDocs: collection({ | ||
label: 'Other Docs', | ||
path: 'design-system/docs/content/**', | ||
slugField: 'title', | ||
entryLayout: 'content', | ||
format: { contentField: 'content' }, | ||
schema: { | ||
title: fields.slug({ name: { label: 'Title' } }), | ||
description: fields.text({ label: 'Description', multiline: true }), | ||
content: fields.markdoc({ | ||
label: 'Content', | ||
options: { | ||
codeBlock: { | ||
schema: { | ||
live: fields.checkbox({ label: 'Live' }), | ||
}, | ||
}, | ||
}, | ||
}), | ||
}, | ||
}), | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.