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

41 lines
1,022 B
JavaScript
Raw Normal View History

2022-09-06 17:46:51 +02:00
import { Li, SumButton, SumDiv } from 'shared/components/workbench/menu'
2022-02-12 15:23:37 +01:00
import { useTranslation } from 'next-i18next'
const Option = props => {
2022-02-13 15:45:27 +01:00
const active = (
2022-09-06 17:46:51 +02:00
props.sampleSettings?.type === 'option' &&
props.active === props.option
2022-02-13 15:45:27 +01:00
)
2022-02-12 15:23:37 +01:00
2022-09-06 17:46:51 +02:00
const setSampleSettings = () => {
props.updateGist(
['sample'],
props.sampleSettings,
true // Close navigation on mobile
)
}
2022-02-13 15:45:27 +01:00
return (
<Li>
2022-09-06 17:46:51 +02:00
<SumButton onClick={setSampleSettings}>
2022-02-13 15:45:27 +01:00
<SumDiv active={active}>
<span className={`
text-3xl inline-block p-0 leading-3 px-2
${active
? 'text-secondary sm:text-secondary-focus translate-y-1 font-bold'
: 'translate-y-3'
}`}
>
{active ? <span>&bull;</span> : <span>&deg;</span>}
</span>
<span className={active ? 'text-secondary font-bold' : ''}>
2022-09-06 17:46:51 +02:00
{props.label}
2022-02-13 15:45:27 +01:00
</span>
</SumDiv>
</SumButton>
</Li>
)
2022-02-12 15:23:37 +01:00
}
export default Option