1
0
Fork 0
freesewing/sites/shared/components/workbench/menus/ui-settings/index.mjs

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-05-31 17:56:58 +02:00
//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'
2023-06-02 13:07:43 -05:00
import { values } from './values.mjs'
2023-05-31 17:56:58 +02:00
export const ns = ['ui-settings']
const UiSetting = ({ name, control, ...rest }) => (
<MenuItem
{...rest}
name={name}
allowToggle={name !== 'control' && control > 3}
control={control}
/>
2023-05-31 17:56:58 +02:00
)
2023-06-07 14:12:51 -05:00
export const UiSettings = ({ update, ui, control, language, DynamicDocs }) => {
const settingsConfig = loadSettingsConfig(ui)
2023-05-31 17:56:58 +02:00
return (
<WorkbenchMenu
{...{
config: settingsConfig,
control,
currentValues: ui,
DynamicDocs,
getDocsPath: (setting) => `site/draft/ui-settings${setting ? `/${setting}` : ''}`,
Icon: DesktopIcon,
inputs,
Item: UiSetting,
values,
language,
name: 'uiSettings',
ns,
updateFunc: update.ui,
}}
/>
2023-05-31 17:56:58 +02:00
)
}