Skip to content

Commit fa9f8b0

Browse files
committed
refactor: add variants to ui/section
1 parent 3962a0d commit fa9f8b0

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/components/ui/section.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
import * as React from "react"
2+
import { cva, type VariantProps } from "class-variance-authority"
23

34
import { cn } from "@/lib/utils/cn"
45

6+
const variants = cva("w-full scroll-mt-20", {
7+
variants: {
8+
variant: {
9+
responsiveFlex: "flex flex-col gap-8 md:flex-row lg:gap-16",
10+
normal: "",
11+
},
12+
},
13+
defaultVariants: {
14+
variant: "normal",
15+
},
16+
})
17+
518
const Section = React.forwardRef<
619
HTMLDivElement,
7-
React.HTMLAttributes<HTMLDivElement>
8-
>(({ className, ...props }, ref) => (
20+
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof variants>
21+
>(({ className, variant, ...props }, ref) => (
922
<section
1023
ref={ref}
11-
className={cn("flex flex-col gap-8 md:flex-row lg:gap-16", className)}
24+
className={cn(variants({ variant, className }))}
1225
{...props}
1326
/>
1427
))

0 commit comments

Comments
 (0)