1
0
Fork 0
freesewing/sites/shared/components/workbench/menu/design-options/index.js

30 lines
998 B
JavaScript
Raw Normal View History

2022-01-25 12:39:29 +01:00
import OptionsIcon from 'shared/components/icons/options.js'
2022-01-29 18:24:36 +01:00
import { Chevron } from 'shared/components/navigation/primary.js'
2022-01-25 12:39:29 +01:00
import OptionGroup from './option-group'
2022-01-29 18:24:36 +01:00
import { Ul, Details, TopSummary, TopSumTitle } from 'shared/components/workbench/menu'
2022-02-08 20:49:19 +01:00
import { useTranslation } from 'next-i18next'
import { optionsMenuStructure } from 'shared/utils.mjs'
2022-01-25 12:39:29 +01:00
const DesignOptions = props => {
2022-02-08 20:49:19 +01:00
const { t } = useTranslation(['app'])
const optionsMenu = optionsMenuStructure(props.design.config.options)
2022-01-25 12:39:29 +01:00
return (
2022-01-29 18:24:36 +01:00
<Details open>
<TopSummary icon={<OptionsIcon />}>
<TopSumTitle>{t('designOptions')}</TopSumTitle>
2022-01-25 12:39:29 +01:00
<Chevron />
2022-01-29 18:24:36 +01:00
</TopSummary>
<Ul className="pl-5 list-inside">
{Object.entries(optionsMenu).map(([group, options]) => typeof options === "string"
? <p>top-level option</p>
: <OptionGroup {...props} group={group} options={options} key={group} />
)}
2022-01-29 18:24:36 +01:00
</Ul>
</Details>
2022-01-25 12:39:29 +01:00
)
}
export default DesignOptions