File size: 1,037 Bytes
d092f57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { FC } from "react"
import ControlButton from "./ControlButton"
import classNames from "classnames"

interface Props {
  value: string
  options: string[]
  setValue: (value: string) => void
  interaction: (touch: boolean) => void
}

const InputRadio: FC<Props> = ({ value, options, setValue, interaction }) => {
  return (
    <>
      {options.map((option) => (
        <ControlButton
          tooltip={"Select " + option}
          key={option}
          interaction={interaction}
          onClick={() => {
            setValue(option)
          }}
          className={classNames(
            "rounded-none flex justify-between items-center py-1",
            value === option ? "bg-dark-800" : ""
          )}
        >
          <span
            className={classNames(
              "rounded-full border-4 mr-2",
              value === option ? "border-green-600" : "border-dark-500"
            )}
          />
          <span>{option}</span>
        </ControlButton>
      ))}
    </>
  )
}

export default InputRadio