Spaces:
Running
Running
Download bioai-platform/frontend/src/components/ui/CriticalButton.tsx from Samad14/bio-nexus-api: direct link, hf CLI and curl.
- Browser
- Download file 994 Bytes
-
https://huggingface.co/spaces/Samad14/bio-nexus-api/resolve/main/bioai-platform/frontend/src/components/ui/CriticalButton.tsx
- Command line
-
hf download hf://spaces/Samad14/bio-nexus-api/bioai-platform/frontend/src/components/ui/CriticalButton.tsx
-
curl -L -o CriticalButton.tsx https://huggingface.co/spaces/Samad14/bio-nexus-api/resolve/main/bioai-platform/frontend/src/components/ui/CriticalButton.tsx
994 Bytes
| 'use client'; | |
| import { CircleNotch as Loader2 } from '@phosphor-icons/react'; | |
| /** | |
| * Solid, deliberate action button for irreversible / expensive actions | |
| * (Run Pipeline, Submit Job, Delete). The hard flat shadow gives it real | |
| * weight so it never feels as casual to click as a clay toggle. | |
| */ | |
| interface CriticalButtonProps { | |
| children: React.ReactNode; | |
| onClick?: () => void; | |
| type?: 'button' | 'submit'; | |
| disabled?: boolean; | |
| loading?: boolean; | |
| variant?: 'run' | 'danger' | 'submit'; | |
| className?: string; | |
| } | |
| export function CriticalButton({ | |
| children, | |
| onClick, | |
| type = 'button', | |
| disabled, | |
| loading, | |
| variant = 'run', | |
| className = '', | |
| }: CriticalButtonProps) { | |
| return ( | |
| <button | |
| type={type} | |
| onClick={onClick} | |
| disabled={disabled || loading} | |
| className={`btn-critical ${variant === 'danger' ? 'btn-critical-danger' : ''} ${className}`} | |
| > | |
| {loading && <Loader2 className="h-4 w-4 animate-spin" />} | |
| {children} | |
| </button> | |
| ); | |
| } | |