chore(repo): initialize planarchy workspace
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { clsx } from "clsx";
|
||||
|
||||
interface BadgeProps {
|
||||
children: React.ReactNode;
|
||||
variant?: "default" | "success" | "warning" | "danger" | "info";
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const variantClasses = {
|
||||
default: "bg-gray-100 text-gray-700",
|
||||
success: "bg-green-100 text-green-700",
|
||||
warning: "bg-yellow-100 text-yellow-700",
|
||||
danger: "bg-red-100 text-red-700",
|
||||
info: "bg-blue-100 text-blue-700",
|
||||
};
|
||||
|
||||
export function Badge({ children, variant = "default", className }: BadgeProps) {
|
||||
return (
|
||||
<span
|
||||
className={clsx(
|
||||
"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",
|
||||
variantClasses[variant],
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { clsx } from "clsx";
|
||||
import type { ButtonHTMLAttributes } from "react";
|
||||
|
||||
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: "primary" | "secondary" | "ghost" | "danger";
|
||||
size?: "sm" | "md" | "lg";
|
||||
}
|
||||
|
||||
const variantClasses = {
|
||||
primary: "bg-brand-600 hover:bg-brand-700 text-white",
|
||||
secondary: "bg-white hover:bg-gray-50 text-gray-700 border border-gray-300",
|
||||
ghost: "text-gray-600 hover:bg-gray-100",
|
||||
danger: "bg-red-600 hover:bg-red-700 text-white",
|
||||
};
|
||||
|
||||
const sizeClasses = {
|
||||
sm: "px-3 py-1.5 text-xs",
|
||||
md: "px-4 py-2 text-sm",
|
||||
lg: "px-6 py-3 text-base",
|
||||
};
|
||||
|
||||
export function Button({
|
||||
variant = "primary",
|
||||
size = "md",
|
||||
className,
|
||||
children,
|
||||
disabled,
|
||||
...props
|
||||
}: ButtonProps) {
|
||||
return (
|
||||
<button
|
||||
className={clsx(
|
||||
"inline-flex items-center justify-center font-medium rounded-lg transition-colors",
|
||||
"focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2",
|
||||
"disabled:opacity-50 disabled:cursor-not-allowed",
|
||||
variantClasses[variant],
|
||||
sizeClasses[size],
|
||||
className,
|
||||
)}
|
||||
disabled={disabled}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export { Button } from "./components/Button.js";
|
||||
export { Badge } from "./components/Badge.js";
|
||||
Reference in New Issue
Block a user