File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
1515 Avatar ,
1616} from "@/components" ;
1717import { Login } from "@/components/Login" ;
18+ import { Badge } from "@/components/Badges" ;
1819
1920export default function page ( ) {
2021 return (
@@ -43,6 +44,16 @@ export default function page() {
4344 < Button > Primary Button</ Button >
4445 </ div >
4546
47+ < div >
48+ < H3 > Badges</ H3 >
49+ < div className = "space-x-2 mt-2" >
50+ < Badge > Default Badge</ Badge >
51+ < Badge variant = "error" > Error Badge</ Badge >
52+ < Badge variant = "success" > Success Badge</ Badge >
53+ < Badge className = "rounded-full" > Rounded Badge</ Badge >
54+ </ div >
55+ </ div >
56+
4657 < div >
4758 < H3 > Forms</ H3 >
4859 < Input />
Original file line number Diff line number Diff line change 1+ import React , { HTMLAttributes } from "react" ;
2+
3+ const variants = {
4+ default : "border-black text-black" ,
5+ error : "border-red-600 text-red-600" ,
6+ success : "border-green-600 text-green-600" ,
7+ } ;
8+
9+ interface ButtonProps extends HTMLAttributes < HTMLSpanElement > {
10+ size ?: "sm" | "md" | "lg" ;
11+ variant ?: keyof typeof variants ;
12+ className ?: string ;
13+ }
14+
15+ export function Badge ( {
16+ children,
17+ size = "md" ,
18+ variant = "default" ,
19+ className = "" ,
20+ ...props
21+ } : ButtonProps ) {
22+ const sizeClasses = {
23+ sm : "px-4 py-1 text-sm" ,
24+ md : "px-2 py-1 text-sm" ,
25+ lg : "px-8 py-3 text-lg" ,
26+ } ;
27+
28+ return (
29+ < span
30+ className = { `text-primary-foreground border-2 ${ variants [ variant ] } ${ sizeClasses [ size ] } ${ className } ` }
31+ { ...props }
32+ >
33+ { children }
34+ </ span >
35+ ) ;
36+ }
Original file line number Diff line number Diff line change 1+ export * from "./Badge"
You can’t perform that action at this time.
0 commit comments