File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ import { cn } from "@/lib/utils" ;
2+ import { type VariantProps , cva } from "class-variance-authority" ;
3+ import type { HTMLAttributes } from "react" ;
4+
5+ const typographyVariants = cva ( "font-head" , {
6+ variants : {
7+ variant : {
8+ h1 : "text-5xl lg:text-6xl font-bold" ,
9+ h2 : "text-3xl lg:text-4xl font-semibold" ,
10+ h3 : "text-2xl font-medium" ,
11+ h4 : "text-xl font-medium" ,
12+ h5 : "text-lg font-medium" ,
13+ h6 : "" ,
14+ } ,
15+ } ,
16+ defaultVariants : {
17+ variant : "h1" ,
18+ } ,
19+ } ) ;
20+
21+ interface TypographyProps
22+ extends HTMLAttributes < HTMLHeadingElement > ,
23+ VariantProps < typeof typographyVariants > {
24+ className ?: string ;
25+ component ?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" ;
26+ }
27+
28+ export const Typography = ( {
29+ className,
30+ component,
31+ variant,
32+ ...props
33+ } : TypographyProps ) => {
34+ const Component = component || "h1" ;
35+ return (
36+ < Component
37+ className = { cn ( typographyVariants ( { variant } ) , className ) }
38+ { ...props }
39+ />
40+ ) ;
41+ } ;
You can’t perform that action at this time.
0 commit comments