ActionCard.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import type { ReactNode } from 'react'
  2. import { Card, cn } from 'ui'
  3. export const ActionCard = (card: {
  4. icon: ReactNode
  5. title: string
  6. bgColor?: string
  7. description?: ReactNode
  8. className?: string
  9. onClick?: () => void
  10. }) => {
  11. return (
  12. <Card
  13. className={cn(
  14. 'grow bg-surface-100 p-3 transition-colors hover:bg-surface-200 border hover:border-default cursor-pointer',
  15. card.className
  16. )}
  17. onClick={card.onClick}
  18. >
  19. <div className="relative flex items-start gap-3">
  20. <div
  21. className={`rounded-full ${card.bgColor} w-8 h-8 flex items-center justify-center shrink-0`}
  22. >
  23. {card.icon}
  24. </div>
  25. <div className="grow flex flex-col gap-0 min-w-0">
  26. <div className="flex items-center gap-x-2">
  27. <h3 title={card.title} className="text-sm text-foreground mb-0 truncate max-w-full">
  28. {card.title}
  29. </h3>
  30. </div>
  31. {typeof card.description === 'string' ? (
  32. <pre className="text-xs text-foreground-light font-sans">{card.description}</pre>
  33. ) : (
  34. card.description
  35. )}
  36. </div>
  37. </div>
  38. </Card>
  39. )
  40. }