feat: add badge prop to DTCard for bevel-clipped badge slot
This commit is contained in:
@@ -33,6 +33,8 @@ interface DTCardProps {
|
|||||||
growArea?: 'body' | 'title';
|
growArea?: 'body' | 'title';
|
||||||
className?: string;
|
className?: string;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
|
/** Badge content rendered at bottom-right, clipped by card bevel */
|
||||||
|
badge?: ReactNode;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,6 +50,7 @@ export function DTCard({
|
|||||||
className,
|
className,
|
||||||
style,
|
style,
|
||||||
onClick,
|
onClick,
|
||||||
|
badge,
|
||||||
}: DTCardProps) {
|
}: DTCardProps) {
|
||||||
const shouldShowHeader = showHeader ?? !!(title || onDismiss);
|
const shouldShowHeader = showHeader ?? !!(title || onDismiss);
|
||||||
const Tag = onClick ? 'button' : 'div';
|
const Tag = onClick ? 'button' : 'div';
|
||||||
@@ -90,6 +93,7 @@ export function DTCard({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{children}
|
{children}
|
||||||
|
{badge && <div className="dt-card-badge">{badge}</div>}
|
||||||
</Tag>
|
</Tag>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user