2
0

card.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { View } from '@tarojs/components'
  2. import { cn } from '@/utils/cn'
  3. interface CardProps {
  4. className?: string
  5. children: React.ReactNode
  6. }
  7. export function Card({ className, children }: CardProps) {
  8. return (
  9. <View className={cn("bg-white rounded-xl shadow-sm", className)}>
  10. {children}
  11. </View>
  12. )
  13. }
  14. interface CardHeaderProps {
  15. className?: string
  16. children: React.ReactNode
  17. }
  18. export function CardHeader({ className, children }: CardHeaderProps) {
  19. return (
  20. <View className={cn("p-4 border-b border-gray-100", className)}>
  21. {children}
  22. </View>
  23. )
  24. }
  25. interface CardContentProps {
  26. className?: string
  27. children: React.ReactNode
  28. }
  29. export function CardContent({ className, children }: CardContentProps) {
  30. return (
  31. <View className={cn("p-4", className)}>
  32. {children}
  33. </View>
  34. )
  35. }
  36. interface CardFooterProps {
  37. className?: string
  38. children: React.ReactNode
  39. }
  40. export function CardFooter({ className, children }: CardFooterProps) {
  41. return (
  42. <View className={cn("p-4 border-t border-gray-100", className)}>
  43. {children}
  44. </View>
  45. )
  46. }