1
0
Fork 0
freesewing/sites/shared/components/workbench/menus/ui-settings/index.mjs
Joost De Cock 86d984e8c5 wip(shared): Split new design pages per design to split bundle
This adds page templates that will auto-generate pages for each design.
This not only allows us to split the bundle for these individual
designs, we are also now passing the inline docs for a design as static
props, as that will limit the memory footprint of webpack.

Remains to be seen how this will all come together, but it's better than
throwing everything at webpack and watching the build fail.
2023-10-08 14:26:58 +02:00

45 lines
1.2 KiB
JavaScript

// __SDEFILE__ - This file is a dependency for the stand-alone environment
//Dependencies
import { loadSettingsConfig } from './config.mjs'
// Components
import { WorkbenchMenu } from '../shared/index.mjs'
import { MenuItem } from '../shared/menu-item.mjs'
import { DesktopIcon } from 'shared/components/icons.mjs'
import { inputs } from './inputs.mjs'
import { values } from './values.mjs'
export const ns = ['ui-settings']
const UiSetting = ({ name, control, ...rest }) => (
<MenuItem
{...rest}
name={name}
allowToggle={!['control', 'view'].includes(name) && control > 3}
control={control}
/>
)
export const UiSettings = ({ update, ui, control, language, docs, view, setView }) => {
const settingsConfig = loadSettingsConfig()
return (
<WorkbenchMenu
{...{
config: settingsConfig,
control,
currentValues: ui,
docs,
getDocsPath: (setting) => `site/draft/ui-settings${setting ? `/${setting}` : ''}`,
Icon: DesktopIcon,
inputs,
Item: UiSetting,
values,
language,
name: 'uiSettings',
ns,
updateFunc: update.ui,
passProps: { view, setView },
}}
/>
)
}