Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
1import { cva, type VariantProps } from "class-variance-authority";
2import { type ElementType, type MouseEvent, memo, type ReactNode } from "react";
3
4const cardVariants = cva(
5 "border-gray-200 dark:border-gray-700 bg-white dark:bg-black",
6 {
7 defaultVariants: { forceRounded: false },
8 variants: {
9 forceRounded: {
10 false: "rounded-none border-y md:rounded-xl md:border",
11 true: "rounded-xl border"
12 }
13 }
14 }
15);
16
17interface CardProps extends VariantProps<typeof cardVariants> {
18 as?: ElementType;
19 children: ReactNode;
20 className?: string;
21 onClick?: (event: MouseEvent<HTMLDivElement>) => void;
22}
23
24const Card = ({
25 as: Tag = "div",
26 children,
27 className = "",
28 forceRounded = false,
29 onClick
30}: CardProps) => {
31 return (
32 <Tag
33 className={cardVariants({ className, forceRounded })}
34 onClick={onClick}
35 >
36 {children}
37 </Tag>
38 );
39};
40
41export default memo(Card);