Skip to content

Commit

Permalink
feat(components): add Card component outline
Browse files Browse the repository at this point in the history
  • Loading branch information
LilaRest committed May 16, 2023
1 parent 6274619 commit a6c1a7d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/components/ui/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";
import { twMerge } from "tailwind-merge";

export const cardVariants = ["default", "borderless"] as const;
export type CardVariant = (typeof cardVariants)[number];

export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
variant?: CardVariant;
}

export const Card = React.forwardRef<HTMLDivElement, CardProps>(
({ className, children, variant = "default", ...props }, ref) => (
<div
className={twMerge(
"",

// Variants
{
default: "",
borderless: "",
}[variant],

// Custom classes
className
)}
{...props}
ref={ref}
>
{children}
</div>
)
);
Card.displayName = "Card";
export default Card;

0 comments on commit a6c1a7d

Please sign in to comment.