Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add card variants (#5893)

authored by yoginth.com and committed by

GitHub c505d7c9 100793c2

+16 -11
+16 -11
apps/web/src/components/Shared/UI/Card.tsx
··· 1 + import { cva, type VariantProps } from "class-variance-authority"; 1 2 import { type ElementType, type MouseEvent, memo, type ReactNode } from "react"; 2 - import cn from "@/helpers/cn"; 3 + 4 + const 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 + ); 3 16 4 - interface CardProps { 17 + interface CardProps extends VariantProps<typeof cardVariants> { 5 18 as?: ElementType; 6 19 children: ReactNode; 7 20 className?: string; 8 - forceRounded?: boolean; 9 21 onClick?: (event: MouseEvent<HTMLDivElement>) => void; 10 22 } 11 23 ··· 18 30 }: CardProps) => { 19 31 return ( 20 32 <Tag 21 - className={cn( 22 - forceRounded 23 - ? "rounded-xl border" 24 - : "rounded-none border-y md:rounded-xl md:border", 25 - "border-gray-200 dark:border-gray-700", 26 - "bg-white dark:bg-black", 27 - className 28 - )} 33 + className={cardVariants({ className, forceRounded })} 29 34 onClick={onClick} 30 35 > 31 36 {children}