index.tsx 903 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import cn from 'classnames'
  5. import s from './style.module.css'
  6. type Props = {
  7. className?: string
  8. title: string
  9. description: string
  10. isChosen: boolean
  11. onChosen: () => void
  12. chosenConfig?: React.ReactNode
  13. icon?: JSX.Element
  14. }
  15. const RadioCard: FC<Props> = ({
  16. title,
  17. description,
  18. isChosen,
  19. onChosen,
  20. icon,
  21. }) => {
  22. return (
  23. <div
  24. className={cn(s.item, isChosen && s.active, 'flex')}
  25. onClick={onChosen}
  26. >
  27. {icon}
  28. <div>
  29. <div className='flex justify-between items-center'>
  30. <div className='leading-5 text-sm font-medium text-gray-900'>{title}</div>
  31. <div className={s.radio}></div>
  32. </div>
  33. <div className='leading-[18px] text-xs font-normal text-gray-500'>{description}</div>
  34. </div>
  35. </div>
  36. )
  37. }
  38. export default React.memo(RadioCard)