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

34 lines
995 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'
import OptionSubGroup from './option-sub-group'
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 => {
2022-02-08 20:49:19 +01:00
const { t } = useTranslation(['app'])
2022-01-25 12:39:29 +01:00
const config = props.config || props.pattern.config.optionGroups[props.group]
return (
2022-01-29 18:24:36 +01:00
<Li>
<Details>
<Summary>
<SumDiv>
<Deg />
<span className="font-bold">
2022-02-08 20:49:19 +01:00
{ t(`optiongroups.${props.group}`) }
2022-01-25 12:39:29 +01:00
</span>
2022-01-29 18:24:36 +01:00
</SumDiv>
<Chevron />
</Summary>
<Ul>
2022-01-25 12:39:29 +01:00
{config.map(option => typeof option === 'string'
? <Option {...props} option={option} key={option} />
: <OptionSubGroup {...props} sub={option} config={config} />
)}
2022-01-29 18:24:36 +01:00
</Ul>
</Details>
</Li>
2022-01-25 12:39:29 +01:00
)
}
export default OptionGroup