fix(lab): Keep docs view out of the lab
This commit is contained in:
parent
78aed4e207
commit
71e1d2b42d
8 changed files with 78 additions and 42 deletions
2
sites/lab/components/design-examples.mjs
Normal file
2
sites/lab/components/design-examples.mjs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
// Lab does not support this
|
||||||
|
export const examples = false
|
|
@ -22,9 +22,13 @@ const DesignsPage = ({ page }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageWrapper {...page} layout={BareLayout}>
|
<PageWrapper {...page} layout={BareLayout}>
|
||||||
<div className="py-4 m-auto">
|
<div className="px-4 m-auto">
|
||||||
<h1 className="text-center">FreeSewing {t('account:designs')}</h1>
|
<h1 className="text-center">FreeSewing {t('account:designs')}</h1>
|
||||||
<DesignPicker hrefBuilder={(design) => `/designs/${design}`} />
|
<DesignPicker
|
||||||
|
hrefBuilder={(design) => `/designs/${design}`}
|
||||||
|
linkTo="docs"
|
||||||
|
altLinkTo="new"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</PageWrapper>
|
</PageWrapper>
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,4 +4,5 @@ export const siteConfig = {
|
||||||
},
|
},
|
||||||
languages: ['en', 'es', 'de', 'fr', 'nl'],
|
languages: ['en', 'es', 'de', 'fr', 'nl'],
|
||||||
repo: 'https://github.com/freesewing/freesewing',
|
repo: 'https://github.com/freesewing/freesewing',
|
||||||
|
site: 'lab',
|
||||||
}
|
}
|
||||||
|
|
3
sites/org/components/design-examples.mjs
Normal file
3
sites/org/components/design-examples.mjs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
import { examples } from 'site/prebuild/design-examples.mjs'
|
||||||
|
|
||||||
|
export { examples }
|
3
sites/sde/components/design-examples.mjs
Normal file
3
sites/sde/components/design-examples.mjs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
// __SDEFILE__ - This file is a dependency for the stand-alone environment
|
||||||
|
// SDE does not support this
|
||||||
|
export const examples = false
|
|
@ -7,7 +7,7 @@ import {
|
||||||
cloudflareImageUrl,
|
cloudflareImageUrl,
|
||||||
} from 'shared/utils.mjs'
|
} from 'shared/utils.mjs'
|
||||||
import { designs } from 'shared/config/designs.mjs'
|
import { designs } from 'shared/config/designs.mjs'
|
||||||
import { examples } from 'site/prebuild/design-examples.mjs'
|
import { examples } from 'site/components/design-examples.mjs'
|
||||||
// Hooks
|
// Hooks
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
import { useDesign } from 'site/hooks/use-design.mjs'
|
import { useDesign } from 'site/hooks/use-design.mjs'
|
||||||
|
@ -141,7 +141,7 @@ export const DesignInfo = ({ design, docs = false, workbench = false }) => {
|
||||||
format={(t) => t.split(':').pop().trim()}
|
format={(t) => t.split(':').pop().trim()}
|
||||||
/>
|
/>
|
||||||
</AnchorLink>
|
</AnchorLink>
|
||||||
<AnchorLink id="examples" txt={t('acount:examples')} />
|
{examples && <AnchorLink id="examples" txt={t('acount:examples')} />}
|
||||||
{['needs', 'fabric'].map((page) => (
|
{['needs', 'fabric'].map((page) => (
|
||||||
<AnchorLink id={page} key={page}>
|
<AnchorLink id={page} key={page}>
|
||||||
<DocsTitle
|
<DocsTitle
|
||||||
|
@ -172,44 +172,52 @@ export const DesignInfo = ({ design, docs = false, workbench = false }) => {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{docs ? docsContent : null}
|
{docs ? docsContent : null}
|
||||||
<h2 id="examples">{t('account:examples')}</h2>
|
{examples ? (
|
||||||
{examples[design] ? (
|
<>
|
||||||
<div className="grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-3">
|
<h2 id="examples">{t('account:examples')}</h2>
|
||||||
{examples[design].map((ex) => (
|
{examples[design] ? (
|
||||||
<button
|
<div className="grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-3">
|
||||||
key={ex}
|
{examples[design].map((ex) => (
|
||||||
onClick={() =>
|
<button
|
||||||
setModal(
|
key={ex}
|
||||||
<ModalWrapper flex="col" justify="top lg:justify-center" slideFrom="right">
|
onClick={() =>
|
||||||
<img
|
setModal(
|
||||||
className="w-full shadow rounded-lg"
|
<ModalWrapper
|
||||||
src={cloudflareImageUrl({ id: `showcase-${ex}`, variant: 'public' })}
|
flex="col"
|
||||||
/>
|
justify="top lg:justify-center"
|
||||||
<p className="text-center">
|
slideFrom="right"
|
||||||
<PageLink href={`/showcase/${ex}`} txt={t('account:visitShowcase')} />
|
>
|
||||||
</p>
|
<img
|
||||||
</ModalWrapper>
|
className="w-full shadow rounded-lg"
|
||||||
)
|
src={cloudflareImageUrl({ id: `showcase-${ex}`, variant: 'public' })}
|
||||||
}
|
/>
|
||||||
>
|
<p className="text-center">
|
||||||
<img
|
<PageLink href={`/showcase/${ex}`} txt={t('account:visitShowcase')} />
|
||||||
className="w-full shadow rounded-lg"
|
</p>
|
||||||
src={cloudflareImageUrl({ id: `showcase-${ex}`, variant: 'sq500' })}
|
</ModalWrapper>
|
||||||
/>
|
)
|
||||||
</button>
|
}
|
||||||
))}
|
>
|
||||||
</div>
|
<img
|
||||||
) : (
|
className="w-full shadow rounded-lg"
|
||||||
<Popout note>
|
src={cloudflareImageUrl({ id: `showcase-${ex}`, variant: 'sq500' })}
|
||||||
<h5>{t('account:noExamples')}</h5>
|
/>
|
||||||
<p>{t('account:noExamplesMsg')}</p>
|
</button>
|
||||||
<p className="text-right">
|
))}
|
||||||
<Link className="btn btn-primary" href="/new/showcase">
|
</div>
|
||||||
{t('account:showcaseNew')}
|
) : (
|
||||||
</Link>
|
<Popout note>
|
||||||
</p>
|
<h5>{t('account:noExamples')}</h5>
|
||||||
</Popout>
|
<p>{t('account:noExamplesMsg')}</p>
|
||||||
)}
|
<p className="text-right">
|
||||||
|
<Link className="btn btn-primary" href="/new/showcase">
|
||||||
|
{t('account:showcaseNew')}
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
</Popout>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
{docs
|
{docs
|
||||||
? null
|
? null
|
||||||
: ['needs', 'fabric'].map((page) => (
|
: ['needs', 'fabric'].map((page) => (
|
||||||
|
|
|
@ -66,6 +66,8 @@ measurements.d: Test the effect of a measurement on the way this pattern looks
|
||||||
menu: Menu
|
menu: Menu
|
||||||
name: Name
|
name: Name
|
||||||
noDesignFound: We could not find this design. This shouldn't happen, so we'd really appreciate you reporting it.
|
noDesignFound: We could not find this design. This shouldn't happen, so we'd really appreciate you reporting it.
|
||||||
|
noInlineDocs: Documention is not included in this build
|
||||||
|
noInlineDocsDesc: Please visit FreeSewing.org to access our documentation
|
||||||
notes: Notes
|
notes: Notes
|
||||||
pages: pages
|
pages: pages
|
||||||
part: Pattern part
|
part: Pattern part
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { useTranslation } from 'next-i18next'
|
||||||
import { DesignInfo } from 'shared/components/designs/info.mjs'
|
import { DesignInfo } from 'shared/components/designs/info.mjs'
|
||||||
import { Popout } from 'shared/components/popout/index.mjs'
|
import { Popout } from 'shared/components/popout/index.mjs'
|
||||||
import { PageLink } from 'shared/components/link.mjs'
|
import { PageLink } from 'shared/components/link.mjs'
|
||||||
|
import { siteConfig } from 'site/site.config.mjs'
|
||||||
|
|
||||||
export const ns = ['workbench', 'designs']
|
export const ns = ['workbench', 'designs']
|
||||||
|
|
||||||
|
@ -12,6 +13,18 @@ export const DocsView = ({ design }) => {
|
||||||
// Hooks
|
// Hooks
|
||||||
const { t } = useTranslation(ns)
|
const { t } = useTranslation(ns)
|
||||||
|
|
||||||
|
if (siteConfig.site !== 'FreeSewing.org')
|
||||||
|
return (
|
||||||
|
<div className="max-w-2xl m-auto">
|
||||||
|
<Popout note>
|
||||||
|
<h5>{t('workbench:noInlineDocs')}</h5>
|
||||||
|
<p>
|
||||||
|
<PageLink txt={t('workbench:noInlineDocsDesc')} href="https://freesewing.org/" />
|
||||||
|
</p>
|
||||||
|
</Popout>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="m-auto mt-8 max-w-7xl px-4 mb-8">
|
<div className="m-auto mt-8 max-w-7xl px-4 mb-8">
|
||||||
<Popout tip compact>
|
<Popout tip compact>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue