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

33 lines
981 B
JavaScript
Raw Normal View History

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 Option from './option'
2022-01-29 18:24:36 +01:00
import { Li, Ul, Details, Summary, SumDiv, Deg } from 'shared/components/workbench/menu'
2022-02-08 20:49:19 +01:00
import { useTranslation } from 'next-i18next'
2022-01-25 12:39:29 +01:00
const OptionGroup = props => {
const { t } = useTranslation(['optiongroups'])
2022-06-17 12:02:09 +02:00
const config = props.config || props.design.config.optionGroups[props.group]
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) }
2022-01-25 12:39:29 +01:00
</span>
2022-01-29 18:24:36 +01:00
</SumDiv>
<Chevron />
</Summary>
<Ul>
{config.map(option =>
typeof option === 'string' ? <Option {...props} option={option} key={option} />
: Object.keys(option).map((sub) => <OptionGroup {...props} config={option[sub]} group={sub} key={sub}/>)
2022-01-25 12:39:29 +01:00
)}
2022-01-29 18:24:36 +01:00
</Ul>
</Details>
</Li>
2022-01-25 12:39:29 +01:00
)
}
export default OptionGroup