2023-06-01 20:18:37 +02:00
|
|
|
import { PanZoomPattern as ReactPattern } from 'shared/components/workbench/pan-zoom-pattern.mjs'
|
2023-05-13 14:17:47 +02:00
|
|
|
import { DraftMenu, ns as menuNs } from './menu.mjs'
|
2023-05-11 19:14:48 +02:00
|
|
|
|
2023-05-13 14:17:47 +02:00
|
|
|
export const ns = menuNs
|
|
|
|
|
|
|
|
export const DraftView = ({
|
|
|
|
design,
|
|
|
|
pattern,
|
|
|
|
patternConfig,
|
|
|
|
setView,
|
|
|
|
settings,
|
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
language,
|
|
|
|
account,
|
2023-05-18 15:25:40 +02:00
|
|
|
DynamicDocs,
|
2023-06-01 17:01:48 +02:00
|
|
|
}) => {
|
|
|
|
let output = null
|
|
|
|
if (ui.renderer === 'svg') {
|
|
|
|
try {
|
|
|
|
const __html = pattern.render()
|
|
|
|
output = <div dangerouslySetInnerHTML={{ __html }} />
|
|
|
|
} catch (err) {
|
|
|
|
console.log(err)
|
|
|
|
}
|
|
|
|
} else output = <ReactPattern renderProps={pattern.getRenderProps()} />
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="flex flex-row">
|
|
|
|
<div className="w-2/3 shrink-0 grow lg:p-4 sticky top-0">
|
|
|
|
<pre>{JSON.stringify(ui, null, 2)}</pre>
|
|
|
|
{output}
|
|
|
|
</div>
|
|
|
|
<div className="w-1/3 shrink grow-0 lg:p-4 max-w-2xl h-screen overflow-scroll">
|
|
|
|
<DraftMenu
|
|
|
|
{...{
|
|
|
|
design,
|
|
|
|
pattern,
|
|
|
|
patternConfig,
|
|
|
|
settings,
|
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
language,
|
|
|
|
account,
|
|
|
|
DynamicDocs,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
2023-05-11 19:14:48 +02:00
|
|
|
</div>
|
2023-06-01 17:01:48 +02:00
|
|
|
)
|
|
|
|
}
|