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 1005B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. function handleChange(dash: string) {
  12. state.send('CHANGED_STYLE', { dash })
  13. }
  14. interface Props {
  15. dash: DashStyle
  16. }
  17. export default function DashPicker({ dash }: Props) {
  18. return (
  19. <Group name="Dash" onValueChange={handleChange}>
  20. <Item
  21. as={RadioGroup.RadioGroupItem}
  22. value={DashStyle.Solid}
  23. isActive={dash === DashStyle.Solid}
  24. >
  25. <DashSolidIcon />
  26. </Item>
  27. <Item
  28. as={RadioGroup.RadioGroupItem}
  29. value={DashStyle.Dashed}
  30. isActive={dash === DashStyle.Dashed}
  31. >
  32. <DashDashedIcon />
  33. </Item>
  34. <Item
  35. as={RadioGroup.RadioGroupItem}
  36. value={DashStyle.Dotted}
  37. isActive={dash === DashStyle.Dotted}
  38. >
  39. <DashDottedIcon />
  40. </Item>
  41. </Group>
  42. )
  43. }