Spaces:
Running
Running
Download src/components/ui/button.tsx from evalstate/mcp-webcam: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/spaces/evalstate/mcp-webcam/resolve/main/src/components/ui/button.tsx
- Command line
-
hf download hf://spaces/evalstate/mcp-webcam/src/components/ui/button.tsx
-
curl -L -o button.tsx https://huggingface.co/spaces/evalstate/mcp-webcam/resolve/main/src/components/ui/button.tsx
1.78 kB
| import * as React from 'react'; | |
| import { Slot } from '@radix-ui/react-slot'; | |
| import { cva, type VariantProps } from 'class-variance-authority'; | |
| import { cn } from '@/lib/utils'; | |
| const buttonVariants = cva( | |
| 'inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-lg text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-push/50 disabled:pointer-events-none disabled:opacity-45 cursor-pointer select-none', | |
| { | |
| variants: { | |
| variant: { | |
| default: 'bg-fg text-bg hover:bg-fg/90 shadow-xs', | |
| accent: 'bg-event text-zinc-950 hover:bg-event/90 font-semibold shadow-xs', | |
| secondary: 'bg-panel-2 text-fg border border-line hover:border-line-strong hover:bg-panel-2/80', | |
| outline: 'border border-line bg-transparent text-fg hover:bg-panel-2 hover:border-line-strong', | |
| ghost: 'text-muted hover:text-fg hover:bg-panel-2', | |
| danger: 'bg-danger/15 text-danger border border-danger/30 hover:bg-danger/25', | |
| }, | |
| size: { | |
| default: 'h-8 px-3', | |
| sm: 'h-7 px-2.5 text-[11px]', | |
| lg: 'h-9 px-4 text-sm', | |
| icon: 'h-8 w-8', | |
| 'icon-sm': 'h-7 w-7', | |
| }, | |
| }, | |
| defaultVariants: { | |
| variant: 'secondary', | |
| size: 'default', | |
| }, | |
| }, | |
| ); | |
| export interface ButtonProps | |
| extends React.ButtonHTMLAttributes<HTMLButtonElement>, | |
| VariantProps<typeof buttonVariants> { | |
| asChild?: boolean; | |
| } | |
| export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( | |
| ({ className, variant, size, asChild = false, ...props }, ref) => { | |
| const Comp = asChild ? Slot : 'button'; | |
| return <Comp ref={ref} className={cn(buttonVariants({ variant, size }), className)} {...props} />; | |
| }, | |
| ); | |
| Button.displayName = 'Button'; | |