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

33 lines
912 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-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>
{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}/>)
}
2022-01-29 18:24:36 +01:00
</Ul>
</Details>
</Li>
2022-01-25 12:39:29 +01:00
)
}
export default OptionGroup