feature-card.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React from 'react'
  2. import {
  3. RiQuestionLine,
  4. } from '@remixicon/react'
  5. import Switch from '@/app/components/base/switch'
  6. import Tooltip from '@/app/components/base/tooltip'
  7. type Props = {
  8. icon: any
  9. title: any
  10. tooltip?: any
  11. value: any
  12. description?: string
  13. children?: React.ReactNode
  14. disabled?: boolean
  15. onChange?: (state: any) => void
  16. onMouseEnter?: () => void
  17. onMouseLeave?: () => void
  18. }
  19. const FeatureCard = ({
  20. icon,
  21. title,
  22. tooltip,
  23. value,
  24. description,
  25. children,
  26. disabled,
  27. onChange,
  28. onMouseEnter,
  29. onMouseLeave,
  30. }: Props) => {
  31. return (
  32. <div
  33. className='mb-1 p-3 border-t-[0.5px] border-l-[0.5px] border-effects-highlight rounded-xl bg-background-section-burn'
  34. onMouseEnter={onMouseEnter}
  35. onMouseLeave={onMouseLeave}
  36. >
  37. <div className='mb-2 flex items-center gap-2'>
  38. {icon}
  39. <div className='grow flex items-center text-text-secondary system-sm-semibold'>
  40. {title}
  41. {tooltip && (
  42. <Tooltip
  43. popupContent={tooltip}
  44. >
  45. <div className='ml-0.5 p-px'><RiQuestionLine className='w-3.5 h-3.5 text-text-quaternary' /></div>
  46. </Tooltip>
  47. )}
  48. </div>
  49. <Switch disabled={disabled} className='shrink-0' onChange={state => onChange?.(state)} defaultValue={value} />
  50. </div>
  51. {description && (
  52. <div className='min-h-8 text-text-tertiary system-xs-regular line-clamp-2'>{description}</div>
  53. )}
  54. {children}
  55. </div>
  56. )
  57. }
  58. export default FeatureCard