diff --git a/src/components/Button.module.css b/src/components/Button.module.css new file mode 100644 index 0000000..77c57f9 --- /dev/null +++ b/src/components/Button.module.css @@ -0,0 +1,8 @@ +.btn { padding: 8px 16px; border: none; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-sans); } +.primary { background: var(--color-primary); color: #fff; } +.primary:hover:not(:disabled) { background: var(--color-primary-hover); } +.secondary { background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text); } +.danger { background: var(--color-error); color: #fff; } +.btn:disabled { opacity: 0.5; cursor: not-allowed; } +.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; margin-right: 6px; } +@keyframes spin { to { transform: rotate(360deg); } } diff --git a/src/components/Button.tsx b/src/components/Button.tsx new file mode 100644 index 0000000..7a72d51 --- /dev/null +++ b/src/components/Button.tsx @@ -0,0 +1,24 @@ +import React from 'react'; +import styles from './Button.module.css'; + +interface ButtonProps { + label: string; + onClick: () => void; + variant?: 'primary' | 'secondary' | 'danger'; + disabled?: boolean; + loading?: boolean; +} + +export const Button: React.FC = ({ + label, onClick, variant = 'primary', disabled = false, loading = false, +}) => ( + +);