Download webui/src/components/ui/Button.tsx from xjackkx/rg: direct link, hf CLI and curl.
- Browser
- Download file 820 Bytes
-
https://huggingface.co/spaces/xjackkx/rg/resolve/main/webui/src/components/ui/Button.tsx
- Command line
-
hf download hf://spaces/xjackkx/rg/webui/src/components/ui/Button.tsx
-
curl -L -o Button.tsx https://huggingface.co/spaces/xjackkx/rg/resolve/main/webui/src/components/ui/Button.tsx
820 Bytes
| import type { ButtonHTMLAttributes } from "react"; | |
| import { cn } from "../../lib/cn"; | |
| type ButtonVariant = "primary" | "secondary" | "ghost" | "danger"; | |
| type ButtonSize = "sm" | "md"; | |
| type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & { | |
| variant?: ButtonVariant; | |
| size?: ButtonSize; | |
| }; | |
| const variantClass: Record<ButtonVariant, string> = { | |
| primary: "btn-primary", | |
| secondary: "btn-secondary", | |
| ghost: "btn-ghost", | |
| danger: "btn-danger", | |
| }; | |
| const sizeClass: Record<ButtonSize, string> = { | |
| sm: "btn-sm", | |
| md: "btn-md", | |
| }; | |
| export function Button({ | |
| className, | |
| variant = "primary", | |
| size = "md", | |
| type = "button", | |
| ...props | |
| }: ButtonProps) { | |
| return ( | |
| <button | |
| type={type} | |
| className={cn("btn", variantClass[variant], sizeClass[size], className)} | |
| {...props} | |
| /> | |
| ); | |
| } | |