feat(org): Added design pages
This commit is contained in:
parent
257504a73f
commit
5e4f7ffb7d
206 changed files with 966 additions and 9753 deletions
|
@ -1,7 +1,7 @@
|
|||
import { useContext } from 'react'
|
||||
import { NavigationContext } from 'shared/context/navigation-context.mjs'
|
||||
import get from 'lodash.get'
|
||||
import Link from 'next/link'
|
||||
import { Link, linkClasses } from 'shared/components/link.mjs'
|
||||
|
||||
const getPage = {
|
||||
dev: (slug, nav) => get(nav, slug.split('/')),
|
||||
|
@ -13,15 +13,17 @@ const getPage = {
|
|||
},
|
||||
}
|
||||
|
||||
export const DocsTitle = ({ slug, className = '', site = 'org' }) => {
|
||||
const defaultFormatter = (title) => title
|
||||
|
||||
export const DocsTitle = ({ slug, className = '', site = 'org', format = defaultFormatter }) => {
|
||||
const { siteNav } = useContext(NavigationContext)
|
||||
const page = getPage[site](slug, siteNav)
|
||||
|
||||
return page ? <span className={className}>{page.t}</span> : null
|
||||
return page ? <span className={className}>{format(page.t)}</span> : null
|
||||
}
|
||||
|
||||
export const DocsLink = (props) => (
|
||||
<Link href={`${props.site === 'org' ? '/docs/' : ''}${props.slug}`}>
|
||||
<Link href={`${props.site === 'org' ? '/docs/' : ''}${props.slug}`} className={linkClasses}>
|
||||
<DocsTitle {...props} />
|
||||
</Link>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue