Category.tsx 1004 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import classNames from "classnames"
  2. export type CategoryProps = {
  3. onChange: (e: any) => void
  4. value: string
  5. currentValue?: string
  6. label: React.ReactNode
  7. }
  8. export const Category = ({
  9. onChange,
  10. value,
  11. currentValue,
  12. label,
  13. }: CategoryProps) => {
  14. return (
  15. <label
  16. className={classNames(
  17. "b3 block cursor-pointer whitespace-nowrap rounded-md border-2 p-3 text-center !font-semibold transition-all md:w-full md:p-4",
  18. value === currentValue
  19. ? "border-blurple-500 bg-blurple-500 text-white hover:border-blurple-600 hover:bg-blurple-600 focus-visible-within:border-blurple-600 focus-visible-within:bg-blurple-600"
  20. : "border-blurple-500 bg-white text-blurple-500 hover:border-blurple-600 hover:text-blurple-600"
  21. )}
  22. >
  23. <input
  24. className="sr-only"
  25. type="radio"
  26. name="apps-selection"
  27. id=""
  28. value={value}
  29. onChange={onChange}
  30. />
  31. {label}
  32. </label>
  33. )
  34. }
  35. export default Category