Spaces:
Sleeping
Sleeping
import React from 'react'; | |
interface CardProps { | |
children: React.ReactNode; | |
className?: string; | |
onClick?: () => void; | |
hoverable?: boolean; | |
} | |
const Card: React.FC<CardProps> = ({ | |
children, | |
className = '', | |
onClick, | |
hoverable = false | |
}) => { | |
return ( | |
<div | |
className={` | |
ios-card | |
${hoverable ? 'cursor-pointer' : ''} | |
${className} | |
`} | |
onClick={onClick} | |
> | |
{children} | |
</div> | |
); | |
}; | |
export interface CardHeaderProps { | |
title: string; | |
subtitle?: string; | |
action?: React.ReactNode; | |
className?: string; | |
} | |
export const CardHeader: React.FC<CardHeaderProps> = ({ | |
title, | |
subtitle, | |
action, | |
className = '' | |
}) => { | |
return ( | |
<div className={`p-4 flex items-center justify-between border-b border-gray-200 ${className}`}> | |
<div> | |
<h3 className="text-lg font-medium">{title}</h3> | |
{subtitle && <p className="text-sm text-gray-500 mt-1">{subtitle}</p>} | |
</div> | |
{action && <div>{action}</div>} | |
</div> | |
); | |
}; | |
export interface CardContentProps { | |
children: React.ReactNode; | |
className?: string; | |
} | |
export const CardContent: React.FC<CardContentProps> = ({ | |
children, | |
className = '' | |
}) => { | |
return <div className={`p-4 ${className}`}>{children}</div>; | |
}; | |
export interface CardFooterProps { | |
children: React.ReactNode; | |
className?: string; | |
} | |
export const CardFooter: React.FC<CardFooterProps> = ({ | |
children, | |
className = '' | |
}) => { | |
return ( | |
<div className={`p-4 border-t border-gray-200 ${className}`}> | |
{children} | |
</div> | |
); | |
}; | |
export default Card; |