- Full rewrite of legacy vanilla JS UI into React SPA - Implement modern design system using Tailwind CSS and shadcn/ui primitives - Create typed API modules and hooks for voice, media, and moderation - Add new features: separated Music and Screen Share panels, Image Grid - Implement unified WebSocket hook for real-time state and PCM audio - Improve visualizer with smooth CSS transitions and live state sync - Add __dirname polyfill for ES module compatibility - Ensure responsive layout for mobile and desktop Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { Slot } from "@radix-ui/react-slot";
|
|
import type * as React from "react";
|
|
import { cn } from "../../lib/utils";
|
|
|
|
type ButtonVariant = "default" | "secondary" | "destructive" | "outline" | "ghost";
|
|
type ButtonSize = "default" | "sm" | "lg" | "icon";
|
|
|
|
const variants: Record<ButtonVariant, string> = {
|
|
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
outline: "border border-border bg-background hover:bg-accent hover:text-accent-foreground",
|
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
};
|
|
|
|
const sizes: Record<ButtonSize, string> = {
|
|
default: "h-10 px-4 py-2",
|
|
sm: "h-9 rounded-md px-3",
|
|
lg: "h-11 rounded-md px-8",
|
|
icon: "h-10 w-10",
|
|
};
|
|
|
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
asChild?: boolean;
|
|
variant?: ButtonVariant;
|
|
size?: ButtonSize;
|
|
}
|
|
|
|
export function Button({
|
|
className,
|
|
variant = "default",
|
|
size = "default",
|
|
asChild = false,
|
|
...props
|
|
}: ButtonProps) {
|
|
const Comp = asChild ? Slot : "button";
|
|
return (
|
|
<Comp
|
|
className={cn(
|
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
variants[variant],
|
|
sizes[size],
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|