2023-06-06 14:43:23 -05:00
|
|
|
import { useTranslation } from 'next-i18next'
|
2023-06-06 13:18:44 -05:00
|
|
|
import { PanZoomPattern } from 'shared/components/workbench/pan-zoom-pattern.mjs'
|
|
|
|
import { TestMenu, ns as menuNs } from './menu.mjs'
|
2023-06-21 21:17:07 -05:00
|
|
|
import { ViewHeader } from '../view-header.mjs'
|
|
|
|
import { PanZoomContextProvider } from 'shared/components/workbench/pattern/pan-zoom-context.mjs'
|
2023-06-06 13:18:44 -05:00
|
|
|
|
2023-06-06 14:31:27 -05:00
|
|
|
export const ns = menuNs
|
2023-06-06 13:18:44 -05:00
|
|
|
|
|
|
|
export const TestView = ({
|
|
|
|
design,
|
|
|
|
pattern,
|
|
|
|
settings,
|
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
language,
|
|
|
|
account,
|
|
|
|
DynamicDocs,
|
|
|
|
}) => {
|
2023-06-06 14:43:23 -05:00
|
|
|
const { t } = useTranslation(ns)
|
2023-06-06 13:18:44 -05:00
|
|
|
if (!pattern) return null
|
|
|
|
if (settings.sample) pattern.sample()
|
|
|
|
else pattern.draft()
|
|
|
|
|
|
|
|
const renderProps = pattern.getRenderProps()
|
|
|
|
const patternConfig = pattern.getConfig()
|
2023-06-06 14:43:23 -05:00
|
|
|
|
|
|
|
const title = t('testThing', { design, thing: t(settings.sample?.[settings.sample.type]) })
|
2023-06-06 13:18:44 -05:00
|
|
|
return (
|
2023-06-21 21:17:07 -05:00
|
|
|
<PanZoomContextProvider>
|
|
|
|
<div className="flex flex-col">
|
|
|
|
<ViewHeader
|
|
|
|
{...{
|
|
|
|
settings,
|
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
control: account.control,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<div className="flex flex-row ml-0 lg:ml-10">
|
|
|
|
<div className="w-2/3 shrink-0 grow lg:p-4 sticky top-0">
|
|
|
|
<h2 className="capitalize">{title}</h2>
|
|
|
|
<PanZoomPattern {...{ renderProps }} />
|
|
|
|
</div>
|
|
|
|
<div className="w-1/3 shrink grow-0 lg:p-4 max-w-2xl h-screen overflow-scroll">
|
|
|
|
<TestMenu
|
|
|
|
{...{
|
|
|
|
design,
|
|
|
|
pattern,
|
|
|
|
patternConfig,
|
|
|
|
settings,
|
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
language,
|
|
|
|
account,
|
|
|
|
DynamicDocs,
|
|
|
|
renderProps,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
2023-06-15 09:23:49 +02:00
|
|
|
</div>
|
2023-06-06 13:18:44 -05:00
|
|
|
</div>
|
2023-06-21 21:17:07 -05:00
|
|
|
</PanZoomContextProvider>
|
2023-06-06 13:18:44 -05:00
|
|
|
)
|
|
|
|
}
|