Spaces:
Running
Running
Create frontend/src/components/ui/button.jsx
Browse files
frontend/src/components/ui/button.jsx
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from "react";
|
| 2 |
+
import { cn } from "@/lib/utils";
|
| 3 |
+
|
| 4 |
+
const base =
|
| 5 |
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none";
|
| 6 |
+
|
| 7 |
+
const variants = {
|
| 8 |
+
default: "bg-indigo-600 text-white hover:bg-indigo-700 shadow-sm",
|
| 9 |
+
outline:
|
| 10 |
+
"border border-slate-200 bg-white text-slate-900 hover:bg-slate-50",
|
| 11 |
+
ghost: "bg-transparent text-slate-700 hover:bg-slate-100",
|
| 12 |
+
};
|
| 13 |
+
|
| 14 |
+
const sizes = {
|
| 15 |
+
default: "h-10 px-4 py-2",
|
| 16 |
+
sm: "h-8 px-3 text-xs",
|
| 17 |
+
lg: "h-11 px-6 text-sm",
|
| 18 |
+
icon: "h-9 w-9",
|
| 19 |
+
};
|
| 20 |
+
|
| 21 |
+
export function Button({
|
| 22 |
+
className,
|
| 23 |
+
variant = "default",
|
| 24 |
+
size = "default",
|
| 25 |
+
...props
|
| 26 |
+
}) {
|
| 27 |
+
return (
|
| 28 |
+
<button
|
| 29 |
+
className={cn(
|
| 30 |
+
base,
|
| 31 |
+
variants[variant] || variants.default,
|
| 32 |
+
sizes[size] || sizes.default,
|
| 33 |
+
className
|
| 34 |
+
)}
|
| 35 |
+
{...props}
|
| 36 |
+
/>
|
| 37 |
+
);
|
| 38 |
+
}
|