Spaces:
Sleeping
Sleeping
File size: 1,896 Bytes
5463318 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | import React from "react";
import { cn } from "../../utils/cn";
import { motion } from "framer-motion";
export const Card = React.forwardRef(
({ className, variant = "default", hoverEffect = false, children, ...props }, ref) => {
const variants = {
default: "bg-card text-card-foreground border-border border",
glass: "glass text-foreground",
glow: "bg-card text-card-foreground border-border border hover:shadow-[0_0_15px_rgba(var(--primary),0.2)] transition-shadow duration-300",
};
const Wrapper = hoverEffect ? motion.div : "div";
const wrapperProps = hoverEffect ? { whileHover: { y: -4 } } : {};
return (
<Wrapper
ref={ref}
{...wrapperProps}
className={cn(
"rounded-xl overflow-hidden",
variants[variant],
className
)}
{...props}
>
{children}
</Wrapper>
);
}
);
Card.displayName = "Card";
export function CardHeader({ className, ...props }) {
return <div className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />;
}
export function CardTitle({ className, ...props }) {
return (
<h3
className={cn("text-2xl font-semibold leading-none tracking-tight", className)}
{...props}
/>
);
}
export function CardDescription({ className, ...props }) {
return (
<p className={cn("text-sm text-muted-foreground", className)} {...props} />
);
}
export function CardContent({ className, ...props }) {
return <div className={cn("p-6 pt-0", className)} {...props} />;
}
export function CardFooter({ className, ...props }) {
return (
<div className={cn("flex items-center p-6 pt-0", className)} {...props} />
);
}
|