2023-01-28 19:27:11 +01:00
|
|
|
import { OptionsIcon } from 'shared/components/icons.mjs'
|
2023-02-05 17:59:22 +01:00
|
|
|
import { Chevron } from 'shared/components/navigation/primary.mjs'
|
2023-01-29 18:57:24 +01:00
|
|
|
import { OptionGroup } from './option-group.mjs'
|
|
|
|
import { OptionComponent } from './option.mjs'
|
2023-02-05 17:59:22 +01:00
|
|
|
import { Ul, Details, TopSummary, TopSumTitle } from 'shared/components/workbench/menu/index.mjs'
|
2022-02-08 20:49:19 +01:00
|
|
|
import { useTranslation } from 'next-i18next'
|
2022-08-29 17:44:50 +02:00
|
|
|
import { optionsMenuStructure } from 'shared/utils.mjs'
|
2022-01-25 12:39:29 +01:00
|
|
|
|
2023-01-29 18:57:24 +01:00
|
|
|
export const DesignOptions = (props) => {
|
2022-02-08 20:49:19 +01:00
|
|
|
const { t } = useTranslation(['app'])
|
2023-01-28 19:27:11 +01:00
|
|
|
const Option = props.Option ? props.Option : OptionComponent
|
2022-09-25 10:45:52 +02:00
|
|
|
const optionsMenu = optionsMenuStructure(props.design.patternConfig.options)
|
2022-01-25 12:39:29 +01:00
|
|
|
|
|
|
|
return (
|
2022-01-29 18:24:36 +01:00
|
|
|
<Details open>
|
|
|
|
<TopSummary icon={<OptionsIcon />}>
|
2022-02-10 21:40:19 +01:00
|
|
|
<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">
|
2023-01-28 19:27:11 +01:00
|
|
|
{Object.entries(optionsMenu).map(([group, options]) =>
|
|
|
|
typeof options === 'string' ? (
|
|
|
|
<Option {...props} type={options} option={group} key={group} />
|
|
|
|
) : (
|
|
|
|
<OptionGroup {...props} group={group} options={options} key={group} Option={Option} />
|
|
|
|
)
|
2022-08-29 17:44:50 +02:00
|
|
|
)}
|
2022-01-29 18:24:36 +01:00
|
|
|
</Ul>
|
|
|
|
</Details>
|
2022-01-25 12:39:29 +01:00
|
|
|
)
|
|
|
|
}
|