Skip to content

Commit

Permalink
refactor: Update CardHeader component to support optional top border,…
Browse files Browse the repository at this point in the history
… displayed by default
  • Loading branch information
NebraskaCoder committed May 17, 2024
1 parent e5fafcd commit 41c45fa
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,28 @@ Card.displayName = "Card";

const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props}
/>
));
React.HTMLAttributes<HTMLDivElement> & {
noTopBorder?: boolean;
forceTopBorder?: boolean;
}
>(
(
{ noTopBorder = false, forceTopBorder = false, className, ...props },
ref
) => (
<div
ref={ref}
className={cn(
"flex flex-col space-y-1.5 p-6",
className,
forceTopBorder || (!noTopBorder && !className)
? "border-t-8 border-slate-800 rounded-md"
: ""
)}
{...props}
/>
)
);
CardHeader.displayName = "CardHeader";

const CardTitle = React.forwardRef<
Expand Down

0 comments on commit 41c45fa

Please sign in to comment.