-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
1 parent
fadde1f
commit f04384e
Showing
59 changed files
with
12,802 additions
and
13,938 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
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
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> | ||
)) | ||
} |
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,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> | ||
) | ||
} |
Oops, something went wrong.