1
0
Fork 0
freesewing/sites/shared/components/workbench/menu/design-options/option-group.mjs

32 lines
939 B
JavaScript
Raw Normal View History

import { Chevron } from 'shared/components/navigation/primary.mjs'
import { Li, Ul, Details, Summary, SumDiv, Deg } from 'shared/components/workbench/menu/index.mjs'
2022-02-08 20:49:19 +01:00
import { useTranslation } from 'next-i18next'
2022-01-25 12:39:29 +01:00
export const OptionGroup = (props) => {
const { t } = useTranslation(['optiongroups'])
2022-09-06 15:33:38 +02:00
const Option = props.Option
2022-01-25 12:39:29 +01:00
return (
2022-01-29 18:24:36 +01:00
<Li>
<Details>
<Summary>
<SumDiv>
<Deg />
<span className="font-bold">{t(props.group)}</span>
2022-01-29 18:24:36 +01:00
</SumDiv>
<Chevron />
</Summary>
<Ul>
{Object.entries(props.options).map(([option, type]) =>
typeof type === 'string' ? (
<Option {...props} type={type} option={option} key={option} />
) : (
<OptionGroup {...props} group={option} options={type} key={option} Option={Option} />
)
)}
2022-01-29 18:24:36 +01:00
</Ul>
</Details>
</Li>
2022-01-25 12:39:29 +01:00
)
}