You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dash-picker.tsx 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {
  2. Group,
  3. Item,
  4. DashDashedIcon,
  5. DashDottedIcon,
  6. DashSolidIcon,
  7. } from '../shared'
  8. import * as RadioGroup from '@radix-ui/react-radio-group'
  9. import { DashStyle } from 'types'
  10. import state from 'state'
  11. import { ChangeEvent } from 'react'
  12. function handleChange(e: ChangeEvent<HTMLInputElement>) {
  13. state.send('CHANGED_STYLE', {
  14. dash: e.currentTarget.value,
  15. })
  16. }
  17. interface Props {
  18. dash: DashStyle
  19. }
  20. export default function DashPicker({ dash }: Props) {
  21. return (
  22. <Group name="Dash" onValueChange={handleChange}>
  23. <Item
  24. as={RadioGroup.RadioGroupItem}
  25. value={DashStyle.Solid}
  26. isActive={dash === DashStyle.Solid}
  27. >
  28. <DashSolidIcon />
  29. </Item>
  30. <Item
  31. as={RadioGroup.RadioGroupItem}
  32. value={DashStyle.Dashed}
  33. isActive={dash === DashStyle.Dashed}
  34. >
  35. <DashDashedIcon />
  36. </Item>
  37. <Item
  38. as={RadioGroup.RadioGroupItem}
  39. value={DashStyle.Dotted}
  40. isActive={dash === DashStyle.Dotted}
  41. >
  42. <DashDottedIcon />
  43. </Item>
  44. </Group>
  45. )
  46. }