Skip to content

Commit

Permalink
squash commits
Browse files Browse the repository at this point in the history
  • Loading branch information
simonswiss committed Jul 23, 2024
1 parent fadde1f commit f04384e
Show file tree
Hide file tree
Showing 59 changed files with 12,802 additions and 13,938 deletions.
9 changes: 7 additions & 2 deletions docs/components/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { Stack } from './primitives/Stack'
import { Header } from './Header'
import { Footer, DocsFooter } from './Footer'
import { type HeadingType } from './Markdoc'
import { type Entry } from '@keystatic/core/reader'
import type keystaticConfig from '../keystatic.config'

function OpenGraph ({
title,
Expand Down Expand Up @@ -57,6 +59,7 @@ export function DocsPage ({
ogImage,
isIndexPage,
editPath,
navigationMap
}: {
children: ReactNode
headings?: HeadingType[]
Expand All @@ -67,6 +70,7 @@ export function DocsPage ({
ogImage?: string
isIndexPage?: boolean
editPath?: string
navigationMap: Entry<typeof keystaticConfig['singletons']['navigation']>
}) {
const contentRef = useRef<HTMLDivElement | null>(null)
const mq = useMediaQuery()
Expand All @@ -89,6 +93,7 @@ export function DocsPage ({
<Header />
<Wrapper
css={mq({
width: '100%',
borderTop: '1px solid var(--border)',
overflowY: 'auto',
display: ['block', null, 'grid'],
Expand All @@ -98,7 +103,7 @@ export function DocsPage ({
gap: ['var(--space-medium)', null, null, 'var(--space-large)', 'var(--space-xlarge)'],
})}
>
<Sidebar isUpdatesPage={isUpdatesPage} />
<Sidebar isUpdatesPage={isUpdatesPage} navigationMap={navigationMap} />
<div
id="content-and-toc"
css={mq({
Expand Down Expand Up @@ -268,4 +273,4 @@ export function Page ({
<Footer />
</Fragment>
)
}
}
58 changes: 17 additions & 41 deletions docs/components/docs/ExamplesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { jsx } from '@emotion/react'
import { Well } from '../primitives/Well'
import { useMediaQuery } from '../../lib/media'
import { InlineCode } from '../../components/primitives/Code'
import { type Examples } from '../../pages/docs'
import { Markdoc } from '../Markdoc'

export function Examples () {
export function Examples ({ examples }: { examples: Examples }) {
const mq = useMediaQuery()
return (
<div
Expand All @@ -16,46 +18,20 @@ export function Examples () {
gap: 'var(--space-xlarge)',
})}
>
<Well
grad="grad3"
heading="Blog"
href="https://github.com/keystonejs/keystone/blob/main/examples/usecase-blog"
target="_blank"
rel="noreferrer"
>
A basic Blog schema with Posts and Authors. Use this as a starting place for learning how to
use Keystone. It’s also a starter for other feature projects.
</Well>
<Well
grad="grad3"
heading="Task Manager"
href="https://github.com/keystonejs/keystone/blob/main/examples/usecase-todo"
target="_blank"
rel="noreferrer"
>
A basic Task Management app, with Tasks and People who can be assigned to tasks. Great for
learning how to use Keystone. It’s also a starter for other feature projects.
</Well>
<Well
grad="grad3"
heading="Extend GraphQL Schema"
href="https://github.com/keystonejs/keystone/blob/main/examples/extend-graphql-schema"
target="_blank"
rel="noreferrer"
>
Shows you how to extend the Keystone GraphQL API with custom queries and mutations. Builds
upon the Blog starter project.
</Well>
<Well
grad="grad3"
heading="Default Values"
href="https://github.com/keystonejs/keystone/blob/main/examples/default-values"
target="_blank"
rel="noreferrer"
>
Demonstrates how to use default values for fields. Builds upon the Task Manager starter
project.
</Well>
{examples.map((example) => (
<Well
grad="grad3"
heading={example.entry.title}
href={example.entry.url}
target="_blank"
rel="noreferrer"
>
{example.entry.description.children.map((child, i) => (
<Markdoc key={i} content={child} />
))}
</Well>
))}

<Well
grad="grad3"
heading="Virtual fields"
Expand Down
55 changes: 55 additions & 0 deletions docs/components/docs/FeaturedDocs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react'
import { notFound } from 'next/navigation'
import { type FeaturedDocsMap } from '../../keystatic/get-featured-docs-map'
import { Fragment } from 'react'
import { Type } from '../primitives/Type'
import { Markdoc } from '../Markdoc'
import { useMediaQuery } from '../../lib/media'
import { Well } from '../primitives/Well'

export function FeaturedDocs({ featuredDocsMap }: { featuredDocsMap: FeaturedDocsMap }) {
const mq = useMediaQuery()
if (!featuredDocsMap?.length) return notFound()

return featuredDocsMap.map((group, i) => (
<Fragment key={i}>
<Type as="h2" look="heading30" margin="2rem 0 1rem 0">
{group.groupName}
</Type>

{group.groupDescription &&
group.groupDescription.children.map((child, i) => (
<Type as="p" look="body18" margin="0 0 1.5rem 0">
<Markdoc key={i} content={child} />
</Type>
))}

{group.items?.length ? (
<div
css={mq({
display: 'grid',
gridTemplateColumns: ['1fr', '1fr', '1fr', '1fr 1fr'],
gap: 'var(--space-xlarge)',
})}
>
{group.items.map((doc) => {
return (
<Well
css={mq({ gridColumn: ['span 1', 'span 1', 'span 1', `span ${doc.wide ? 2 : 1}`] })}
key={doc.href}
grad={doc.gradient || group.gradient}
heading={doc.label}
href={doc.href}
>
{doc.description &&
doc.description.children.map((child, i) => <Markdoc key={i} content={child} />)}
</Well>
)
})}
</div>
) : null}
</Fragment>
))
}
56 changes: 56 additions & 0 deletions docs/components/docs/FeaturedExamples.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@emotion/react'
import { notFound } from 'next/navigation'
import { type FeaturedDocsMap } from '../../keystatic/get-featured-docs-map'
import { Fragment } from 'react'
import { Type } from '../primitives/Type'
import { Markdoc } from '../Markdoc'
import { useMediaQuery } from '../../lib/media'
import { Well } from '../primitives/Well'

export function FeaturedExamples({ featuredExamples }: { featuredExamples: any }) {
const mq = useMediaQuery()

return (
<Fragment>
<Type as="h2" look="heading30" margin="2rem 0 1rem 0">
{featuredExamples.label}
</Type>

{featuredExamples.description &&
featuredExamples.description.node.children.map((child, i) => (
<Type as="p" look="body18" margin="0 0 1.5rem 0">
<Markdoc key={i} content={child} />
</Type>
))}

{featuredExamples.items?.length ? (
<div
css={mq({
display: 'grid',
gridTemplateColumns: ['1fr', '1fr', '1fr', '1fr 1fr'],
gap: 'var(--space-xlarge)',
})}
>
{featuredExamples.items.map((item) => {
return (
<Well
css={mq({
gridColumn: ['span 1', 'span 1', 'span 1', `span ${item.wide ? 2 : 1}`],
})}
key={item.url}
grad={featuredExamples.gradient}
heading={item.title}
href={item.url}
>
{item.description &&
item.description.children.map((child, i) => <Markdoc key={i} content={child} />)}
</Well>
)
})}
</div>
) : null}
</Fragment>
)
}
Loading

0 comments on commit f04384e

Please sign in to comment.