Spaces:
Sleeping
Sleeping
Download components/Button.tsx from codebybrody/codebydante: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/codebybrody/codebydante/resolve/269ea4c5aa9c8ed277c8c5953a3a48b04d280430/components/Button.tsx
- Command line
-
hf download hf://spaces/codebybrody/codebydante@269ea4c5aa9c8ed277c8c5953a3a48b04d280430/components/Button.tsx
-
curl -L -o Button.tsx https://huggingface.co/spaces/codebybrody/codebydante/resolve/269ea4c5aa9c8ed277c8c5953a3a48b04d280430/components/Button.tsx
1.41 kB
| import React from 'react'; | |
| interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { | |
| variant?: 'primary' | 'secondary' | 'danger' | 'ghost' | 'outline'; | |
| isLoading?: boolean; | |
| } | |
| export const Button: React.FC<ButtonProps> = ({ | |
| children, | |
| variant = 'primary', | |
| className = '', | |
| isLoading = false, | |
| ...props | |
| }) => { | |
| const baseStyles = "px-4 py-2 rounded-lg font-medium transition-all duration-200 flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed"; | |
| const variants = { | |
| primary: "bg-primary text-background hover:bg-opacity-90 shadow-[0_0_10px_rgba(187,134,252,0.3)]", | |
| secondary: "bg-surfaceHover text-white hover:bg-white/10 border border-white/10", | |
| outline: "bg-transparent border border-primary text-primary hover:bg-primary hover:text-background shadow-[0_0_5px_rgba(187,134,252,0.2)]", | |
| danger: "bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20", | |
| ghost: "text-gray-400 hover:text-white hover:bg-white/5" | |
| }; | |
| return ( | |
| <button | |
| className={`${baseStyles} ${variants[variant]} ${className}`} | |
| disabled={isLoading || props.disabled} | |
| {...props} | |
| > | |
| {isLoading ? ( | |
| <span className="animate-spin h-4 w-4 border-2 border-current border-t-transparent rounded-full" /> | |
| ) : null} | |
| {children} | |
| </button> | |
| ); | |
| }; |