Spaces:
Sleeping
Sleeping
Naufal Arhab
feat: initial release of PerpsAI multi-exchange intelligence, Neon DB, and Tanya AI
712f4ea Download frontend/src/components/ui/Button.tsx from agus1111/Perps-Terminal: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/spaces/agus1111/Perps-Terminal/resolve/main/frontend/src/components/ui/Button.tsx
- Command line
-
hf download hf://spaces/agus1111/Perps-Terminal/frontend/src/components/ui/Button.tsx
-
curl -L -o Button.tsx https://huggingface.co/spaces/agus1111/Perps-Terminal/resolve/main/frontend/src/components/ui/Button.tsx
1.74 kB
| import React from 'react'; | |
| import { clsx } from 'clsx'; | |
| import { twMerge } from 'tailwind-merge'; | |
| function cn(...inputs: Parameters<typeof clsx>) { | |
| return twMerge(clsx(inputs)); | |
| } | |
| interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { | |
| variant?: 'primary' | 'ghost' | 'danger' | 'success'; | |
| size?: 'sm' | 'md' | 'lg'; | |
| loading?: boolean; | |
| icon?: React.ReactNode; | |
| } | |
| const variantStyles = { | |
| primary: 'bg-accent-blue hover:bg-blue-600 text-white border-transparent', | |
| ghost: 'bg-transparent hover:bg-bg-elevated text-text-secondary hover:text-text-primary border-border', | |
| danger: 'bg-transparent hover:bg-signal-short-bg text-signal-short border-signal-short/30 hover:border-signal-short/60', | |
| success: 'bg-transparent hover:bg-signal-long-bg text-signal-long border-signal-long/30 hover:border-signal-long/60', | |
| }; | |
| const sizeStyles = { | |
| sm: 'text-xs px-2.5 py-1.5 gap-1', | |
| md: 'text-sm px-4 py-2 gap-2', | |
| lg: 'text-base px-5 py-2.5 gap-2', | |
| }; | |
| export function Button({ | |
| variant = 'ghost', | |
| size = 'md', | |
| loading = false, | |
| icon, | |
| children, | |
| className, | |
| disabled, | |
| ...props | |
| }: ButtonProps) { | |
| return ( | |
| <button | |
| className={cn( | |
| 'inline-flex items-center justify-center font-medium rounded-lg border', | |
| 'transition-colors duration-150 cursor-pointer', | |
| 'disabled:opacity-50 disabled:cursor-not-allowed', | |
| variantStyles[variant], | |
| sizeStyles[size], | |
| className | |
| )} | |
| disabled={disabled || loading} | |
| {...props} | |
| > | |
| {loading ? ( | |
| <span className="w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin" /> | |
| ) : icon ? ( | |
| icon | |
| ) : null} | |
| {children} | |
| </button> | |
| ); | |
| } | |