c_agri_trade/project_code/frontend/src/components/ui/Card.tsx

36 lines
921 B
TypeScript

import React from 'react';
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
title?: string;
subtitle?: string;
action?: React.ReactNode;
}
export const Card: React.FC<CardProps> = ({
title,
subtitle,
action,
children,
className = '',
...props
}) => {
return (
<div
className={`bg-card-surface border border-card-border rounded shadow-none ${className}`}
{...props}
>
{(title || action) && (
<div className="px-6 py-4 border-b border-card-border flex items-center justify-between">
<div>
{title && <h3 className="text-base font-semibold text-text-primary tracking-tight">{title}</h3>}
{subtitle && <p className="text-xs text-text-muted mt-0.5">{subtitle}</p>}
</div>
{action && <div>{action}</div>}
</div>
)}
<div className="p-6">{children}</div>
</div>
);
};