2021-06-02 11:50:34 +00:00
|
|
|
import {
|
|
|
|
Group,
|
|
|
|
Item,
|
|
|
|
DashDashedIcon,
|
|
|
|
DashDottedIcon,
|
|
|
|
DashSolidIcon,
|
2021-06-03 12:06:39 +00:00
|
|
|
} from '../shared'
|
2021-06-02 11:50:34 +00:00
|
|
|
import * as RadioGroup from '@radix-ui/react-radio-group'
|
2021-06-01 21:49:32 +00:00
|
|
|
import { DashStyle } from 'types'
|
|
|
|
import state from 'state'
|
|
|
|
import { ChangeEvent } from 'react'
|
|
|
|
|
|
|
|
function handleChange(e: ChangeEvent<HTMLInputElement>) {
|
|
|
|
state.send('CHANGED_STYLE', {
|
|
|
|
dash: e.currentTarget.value,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
dash: DashStyle
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function DashPicker({ dash }: Props) {
|
|
|
|
return (
|
|
|
|
<Group name="Dash" onValueChange={handleChange}>
|
2021-06-02 11:50:34 +00:00
|
|
|
<Item
|
|
|
|
as={RadioGroup.RadioGroupItem}
|
|
|
|
value={DashStyle.Solid}
|
|
|
|
isActive={dash === DashStyle.Solid}
|
|
|
|
>
|
2021-06-01 21:49:32 +00:00
|
|
|
<DashSolidIcon />
|
2021-06-02 11:50:34 +00:00
|
|
|
</Item>
|
|
|
|
<Item
|
|
|
|
as={RadioGroup.RadioGroupItem}
|
|
|
|
value={DashStyle.Dashed}
|
|
|
|
isActive={dash === DashStyle.Dashed}
|
|
|
|
>
|
2021-06-01 21:49:32 +00:00
|
|
|
<DashDashedIcon />
|
2021-06-02 11:50:34 +00:00
|
|
|
</Item>
|
|
|
|
<Item
|
|
|
|
as={RadioGroup.RadioGroupItem}
|
|
|
|
value={DashStyle.Dotted}
|
|
|
|
isActive={dash === DashStyle.Dotted}
|
|
|
|
>
|
2021-06-01 21:49:32 +00:00
|
|
|
<DashDottedIcon />
|
2021-06-02 11:50:34 +00:00
|
|
|
</Item>
|
2021-06-01 21:49:32 +00:00
|
|
|
</Group>
|
|
|
|
)
|
|
|
|
}
|