File size: 994 Bytes
d54a751
 
349f22c
d54a751
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'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>
  );
}