11import * as React from "react"
22import { LucideIcon } from "lucide-react"
3+ import { cva , type VariantProps } from "class-variance-authority"
34import { cn } from "@/lib/utils"
45
5- interface HighlighterTextProps extends React . HTMLAttributes < HTMLDivElement > {
6+ const highlighterTextVariants = cva (
7+ "inline-flex items-center font-mono text-xs uppercase font-medium tracking-wide px-2 py-1 rounded-[2px]" ,
8+ {
9+ variants : {
10+ variant : {
11+ default : "bg-muted text-muted-foreground" ,
12+ blue : "text-blue-700 bg-blue-500/10 dark:text-blue-200 dark:bg-blue-800/50" ,
13+ amber : "text-amber-700 bg-amber-500/10 dark:text-amber-200 dark:bg-amber-800/50" ,
14+ } ,
15+ } ,
16+ defaultVariants : {
17+ variant : "default" ,
18+ } ,
19+ }
20+ )
21+
22+ const highlighterIconVariants = cva (
23+ "flex items-center justify-center font-mono text-xs uppercase font-medium tracking-wide size-6 rounded-[2px]" ,
24+ {
25+ variants : {
26+ variant : {
27+ default : "bg-muted text-muted-foreground" ,
28+ blue : "text-blue-700 bg-blue-500/10 dark:text-blue-200 dark:bg-blue-800/50" ,
29+ amber : "text-amber-700 bg-amber-500/10 dark:text-amber-200 dark:bg-amber-800/50" ,
30+ } ,
31+ } ,
32+ defaultVariants : {
33+ variant : "default" ,
34+ } ,
35+ }
36+ )
37+
38+ interface HighlighterTextProps extends React . HTMLAttributes < HTMLDivElement > , VariantProps < typeof highlighterTextVariants > {
639 children : React . ReactNode
740 icon ?: LucideIcon
841}
@@ -11,27 +44,17 @@ export default function HighlighterText({
1144 children,
1245 className,
1346 icon : Icon ,
47+ variant,
1448 ...props
1549} : HighlighterTextProps ) {
1650 if ( Icon ) {
1751 return (
1852 < div className = "inline-flex items-center gap-1.5" >
19- < div
20- className = { cn (
21- "flex items-center justify-center font-mono text-xs uppercase font-medium tracking-wide" ,
22- "bg-muted text-muted-foreground" ,
23- "size-6 rounded-[2px]"
24- ) }
25- >
53+ < div className = { cn ( highlighterIconVariants ( { variant } ) ) } >
2654 < Icon className = "size-4" />
2755 </ div >
2856 < div
29- className = { cn (
30- "inline-flex items-center font-mono text-xs uppercase font-medium tracking-wide" ,
31- "bg-muted text-muted-foreground" ,
32- "px-2 py-1 rounded-[2px]" ,
33- className
34- ) }
57+ className = { cn ( highlighterTextVariants ( { variant } ) , className ) }
3558 { ...props }
3659 >
3760 { children }
@@ -42,12 +65,7 @@ export default function HighlighterText({
4265
4366 return (
4467 < div
45- className = { cn (
46- "inline-flex items-center font-mono text-xs uppercase font-medium tracking-wide" ,
47- "bg-muted text-muted-foreground" ,
48- "px-2 py-1 rounded-[2px]" ,
49- className
50- ) }
68+ className = { cn ( highlighterTextVariants ( { variant } ) , className ) }
5169 { ...props }
5270 >
5371 { children }
0 commit comments