Scaffold CommiTea: yarn workspaces, Electron shell, core label schema, design system
- apps/desktop: electron-vite + React + Tailwind mapped onto design tokens (preflight off; tokens/base.css owns the reset); boots to a Reginald placeholder proving fonts/tokens/core wiring - packages/core: pure TS; gitea label schema (est/*, p/*, deadline/hard) with pessimistic conflict resolution + 15 unit tests - docs/design: full design handoff (tokens, 16 component contracts, interactive 14-screen prototype, Reginald voice rules) - docs/PLAN.md: product plan (purity rule, pm-state repo, deterministic scheduler + Monte Carlo, directive log) - Deliberate deviation from novelpad stack: no ElectricSQL/PGlite — local store is a rebuildable cache over gitea REST/webhooks (better-sqlite3 in main process, arriving in P1) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
63
docs/design/components/core/Button.js.txt
Normal file
63
docs/design/components/core/Button.js.txt
Normal file
@@ -0,0 +1,63 @@
|
||||
import React from 'react';
|
||||
|
||||
const CSS = `
|
||||
.ct-btn {
|
||||
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
||||
font: 600 14px/1 var(--font-sans);
|
||||
border-radius: var(--radius-2);
|
||||
border: 1px solid transparent;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: background var(--duration-fast) var(--ease-out),
|
||||
border-color var(--duration-fast) var(--ease-out),
|
||||
color var(--duration-fast) var(--ease-out);
|
||||
}
|
||||
.ct-btn:disabled { opacity: 0.45; cursor: not-allowed; }
|
||||
.ct-btn--md { height: 34px; padding: 0 14px; }
|
||||
.ct-btn--sm { height: 28px; padding: 0 10px; font-size: 13px; }
|
||||
.ct-btn--primary { background: var(--accent); color: var(--text-on-accent); }
|
||||
.ct-btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
|
||||
.ct-btn--primary:active:not(:disabled) { background: var(--accent-pressed); }
|
||||
.ct-btn--secondary { background: var(--surface-card); border-color: var(--line-2); color: var(--ink-1); }
|
||||
.ct-btn--secondary:hover:not(:disabled) { background: var(--paper-2); }
|
||||
.ct-btn--secondary:active:not(:disabled) { background: var(--paper-3); }
|
||||
.ct-btn--ghost { background: transparent; color: var(--ink-2); }
|
||||
.ct-btn--ghost:hover:not(:disabled) { background: var(--paper-2); color: var(--ink-1); }
|
||||
.ct-btn--ghost:active:not(:disabled) { background: var(--paper-3); }
|
||||
.ct-btn--danger { background: var(--danger); color: var(--ink-inverse); }
|
||||
.ct-btn--danger:hover:not(:disabled) { filter: brightness(0.92); }
|
||||
`;
|
||||
(function inject() {
|
||||
if (typeof document !== 'undefined' && !document.getElementById('ct-button-css')) {
|
||||
const s = document.createElement('style'); s.id = 'ct-button-css'; s.textContent = CSS;
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
})();
|
||||
|
||||
import { Icon } from './Icon';
|
||||
|
||||
export function Button({
|
||||
variant = 'primary',
|
||||
size = 'md',
|
||||
icon,
|
||||
iconRight,
|
||||
disabled = false,
|
||||
children,
|
||||
style,
|
||||
...rest
|
||||
}) {
|
||||
const iconSize = size === 'sm' ? 15 : 17;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={`ct-btn ct-btn--${size} ct-btn--${variant}`}
|
||||
disabled={disabled}
|
||||
style={style}
|
||||
{...rest}
|
||||
>
|
||||
{icon ? <Icon name={icon} size={iconSize} /> : null}
|
||||
{children}
|
||||
{iconRight ? <Icon name={iconRight} size={iconSize} /> : null}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user