8000 Move the Editor surface to colour names, with focus rings by kiran-brahma · Pull Request #79 · kiran-brahma/writing-tool · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,16 @@ export default function App() {
if (status === "loading") {
return (
<CenteredMessage>
<p className="text-stone-500">Opening your Library…</p>
<p className="text-faint-ink">Opening your Library…</p>
</CenteredMessage>
);
}

if (status === "error") {
return (
<CenteredMessage>
<h1 className="text-lg font-semibold text-stone-900">Obelus could not open your Library</h1>
<p className="mt-2 max-w-md text-sm text-stone-600">{openError}</p>
<h1 className="text-lg font-semibold text-ink">Obelus could not open your Library</h1>
<p className="mt-2 max-w-md text-sm text-muted-ink">{openError}</p>
</CenteredMessage>
);
}
Expand Down Expand Up @@ -413,11 +413,11 @@ export default function App() {
};

return (
<div className="flex min-h-screen flex-col bg-stone-50 text-stone-900">
<header className="flex items-center justify-between gap-3 sm:gap-4 border-b border-stone-200 px-3 sm:px-6 py-2.5 whitespace-nowrap overflow-x-auto min-w-0 bg-stone-50 text-stone-900">
<div className="flex min-h-screen flex-col bg-ground text-ink">
<header className="flex items-center justify-between gap-3 sm:gap-4 border-b border-rule-soft px-3 sm:px-6 py-2.5 whitespace-nowrap overflow-x-auto min-w-0 bg-ground text-ink">
<div className="shrink-0">
<h1 className="text-base font-semibold tracking-tight text-stone-900">Obelus</h1>
<p className="hidden sm:block text-xs text-stone-500">It marks; it never holds the pen.</p>
<h1 className="text-base font-semibold tracking-tight text-ink">Obelus</h1>
<p className="hidden sm:block text-xs text-faint-ink">It marks; it never holds the pen.</p>
</div>
<div className="flex items-center gap-2 sm:gap-4 shrink-0">
<DocumentMenu
Expand All @@ -426,7 +426,7 @@ export default function App() {
>
canExport={document !== null}
/>
<div className="h-4 w-px bg-stone-300" aria-hidden="true" />
<div className="h-4 w-px bg-rule" aria-hidden="true" />
<nav aria-label="Main navigation" className="flex items-center gap-0.5 sm:gap-1 shrink-0">
{DESTINATIONS.map(({ id, label }) => {
const isCurrent = isCurrentDestination(id, view);
Expand All @@ -438,10 +438,10 @@ export default function App() {
aria-current={isCurrent ? "page" : undefined}
=> navigateTo(id)}
className={[
"rounded px-2 sm:px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stone-600",
"rounded px-2 sm:px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",
isCurrent
? "bg-stone-900 font-semibold text-stone-50 shadow-xs"
: "text-stone-600 hover:bg-stone-200/70 hover:text-stone-900",
? "bg-ink font-semibold text-on-ink shadow-xs focus-visible:ring-offset-2"
: "text-muted-ink hover:bg-sunk-strong/70 hover:text-ink",
].join(" ")}
>
{label}
Expand All @@ -453,26 +453,26 @@ export default function App() {
</header>

{saveError !== null && (
<div className="border-b border-amber-200 bg-amber-50 px-6 py-2 text-sm text-amber-900">
<div className="border-b border-failure-rule bg-failure-surface px-6 py-2 text-sm text-failure">
Could not save your document: {saveError}
</div>
)}

{storageNotice !== null && (
<div className="flex items-center justify-between gap-4 border-b border-amber-200 bg-amber-50 px-6 py-2 text-sm text-amber-900">
<div className="flex items-center justify-between gap-4 border-b border-warning-rule bg-warning-surface px-6 py-2 text-sm text-warning">
<span>{storageNotice}</span>
<button
type="button"
>
className="shrink-0 rounded border border-amber-300 px-2 py-0.5 text-xs font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-700"
className="shrink-0 rounded border border-warning-rule-strong px-2 py-0.5 text-xs font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-warning-focus"
>
Dismiss
</button>
</div>
)}

{importError !== null && (
<div className="border-b border-amber-200 bg-amber-50 px-6 py-2 text-sm text-amber-900">
<div className="border-b border-failure-rule bg-failure-surface px-6 py-2 text-sm text-failure">
Could not import that markdown: {importError}
</div>
)}
Expand Down Expand Up @@ -544,7 +544,7 @@ export default function App() {

{view === "editor" && (
<div className="flex min-h-0 flex-1">
<main className="flex min-h-0 flex-1 flex-col bg-white">
<main className="flex min-h-0 flex-1 flex-col bg-paper">
{document !== null && (
<>
<DocumentTitleField
Expand Down Expand Up @@ -649,7 +649,7 @@ function DocumentTitleField({
}}
aria-label="Document title"
placeholder="Untitled"
className="border-b border-stone-200 bg-white px-8 py-3 text-xl font-semibold tracking-tight text-stone-900 focus:outline-none"
className="border-b border-rule-soft bg-paper px-8 py-3 text-xl font-semibold tracking-tight text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus"
/>
);
}
Expand All @@ -676,19 +676,19 @@ function EditorNote({
onDismiss?: () => void;
}) {
return (
<aside className="border-b border-stone-200 bg-stone-50 px-8 py-3">
<aside className="border-b border-rule-soft bg-ground px-8 py-3">
<div className="flex items-start justify-between gap-4">
<div>
<h2 className="text-sm font-semibold text-stone-900">{heading}</h2>
<h2 className="text-sm font-semibold text-ink">{heading}</h2>
{body.map((paragraph) => (
<p key={paragraph} className="mt-1 text-sm leading-relaxed text-stone-600">
<p key={paragraph} className="mt-1 text-sm leading-relaxed text-muted-ink">
{paragraph}
</p>
))}
<button
type="button"
>
className="mt-2 text-sm font-medium text-blue-700 underline underline-offset-2 hover:text-blue-900"
className="mt-2 rounded text-sm font-medium text-link underline underline-offset-2 hover:text-link-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
{actionLabel}
</button>
Expand All @@ -697,7 +697,7 @@ function EditorNote({
<button
type="button"
>
className="shrink-0 rounded border border-stone-300 bg-white px-2.5 py-1 text-xs font-medium text-stone-700 hover:bg-stone-100"
className="shrink-0 rounded border border-rule bg-paper px-2.5 py-1 text-xs font-medium text-quiet-ink hover:bg-sunk focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
{dismissLabel}
</button>
Expand Down Expand Up @@ -730,7 +730,7 @@ function slug(title: string): string {

function CenteredMessage({ children }: { children: ReactNode }) {
return (
<div className="flex min-h-screen flex-col items-center justify-center bg-stone-50 text-center">
<div className="flex min-h-screen flex-col items-center justify-center bg-ground text-center">
{children}
</div>
);
Expand Down
14 changes: 7 additions & 7 deletions src/DocumentMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ export function DocumentMenu({
aria-controls={open ? "document-actions-menu" : undefined}
aria-label="Document actions"
=> setOpen((prev) => !prev)}
className="flex items-center gap-1.5 rounded border border-stone-300 bg-white px-2.5 py-1 text-xs font-medium text-stone-700 hover:bg-stone-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stone-600 transition-colors"
className="flex items-center gap-1.5 rounded border border-rule bg-paper px-2.5 py-1 text-xs font-medium text-quiet-ink hover:bg-sunk focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus transition-colors"
>
<span>Document</span>
<span aria-hidden="true" className="text-stone-400">
<span aria-hidden="true" className="text-ghost-ink">
▾
</span>
</button>
Expand All @@ -84,15 +84,15 @@ export function DocumentMenu({
id="document-actions-menu"
role="menu"
aria-label="Document actions"
className="absolute left-0 top-full mt-1.5 w-44 rounded border border-stone-200 bg-white py-1 shadow-md z-30"
className="absolute left-0 top-full mt-1.5 w-44 rounded border border-rule-soft bg-paper py-1 shadow-md z-30"
>
<div className="border-b border-stone-100 px-3 py-1.5 text-xs text-stone-500">
<span className="font-semibold text-stone-700">
<div className="border-b border-rule-faint px-3 py-1.5 text-xs text-faint-ink">
<span className="font-semibold text-quiet-ink">
{wordCount.toLocaleString()}
</span>{" "}
{wordCount === 1 ? "word" : "words"}
</div>
<label className="flex w-full cursor-pointer items-center px-3 py-1.5 text-xs text-stone-700 hover:bg-stone-50 transition-colors">
<label className="flex w-full cursor-pointer items-center px-3 py-1.5 text-xs text-quiet-ink hover:bg-ground has-focus-visible:outline-none has-focus-visible:ring-2 has-focus-visible:ring-focus transition-colors">
Import Markdown
<input
type="file"
Expand All @@ -106,7 +106,7 @@ export function DocumentMenu({
role="menuitem"
>
disabled={!canExport}
className="flex w-full items-center px-3 py-1.5 text-xs text-stone-700 hover:bg-stone-50 disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-left"
className="flex w-full items-center px-3 py-1.5 text-xs text-quiet-ink hover:bg-ground disabled:opacity-40 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus transition-colors text-left"
>
Export Markdown
</button>
Expand Down
10 changes: 5 additions & 5 deletions src/editor/DocumentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ export function DocumentEditor({

function Toolbar({ editor }: { editor: Editor | null }) {
if (editor === null) {
return <div className="h-11 border-b border-stone-200" />;
return <div className="h-11 border-b border-rule-soft" />;
}

return (
<div className="flex flex-wrap items-center gap-1 border-b border-stone-200 px-3 py-1.5">
<div className="flex flex-wrap items-center gap-1 border-b border-rule-soft px-3 py-1.5">
<ToolbarButton
label="Heading 1"
active={editor.isActive("heading", { level: 1 })}
Expand Down Expand Up @@ -402,7 +402,7 @@ function Toolbar({ editor }: { editor: Editor | null }) {
}

function Separator() {
return <span className="mx-1 h-5 w-px bg-stone-200" aria-hidden="true" />;
return <span className="mx-1 h-5 w-px bg-sunk-strong" aria-hidden="true" />;
}

interface ToolbarButtonProps {
Expand All @@ -421,8 +421,8 @@ function ToolbarButton({ label, active = false, onClick, children }: ToolbarButt
aria-pressed={active}
>
className={[
"rounded px-2 py-1 text-sm transition-colors",
active ? "bg-stone-900 text-stone-50" : "text-stone-700 hover:bg-stone-100",
"rounded px-2 py-1 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",
active ? "bg-ink text-on-ink focus-visible:ring-offset-2" : "text-quiet-ink hover:bg-sunk",
].join(" ")}
>
{children}
Expand Down
10 changes: 5 additions & 5 deletions src/editor/FindingCallout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function FindingCallout({
role="dialog"
aria-label={findings.length === 1 ? "Finding" : `${findings.length} Findings`}
style={{ left: position.left, top: position.top }}
className="fixed z-40 w-72 divide-y divide-stone-200 rounded-md border border-stone-300 bg-white text-sm shadow-md"
className="fixed z-40 w-72 divide-y divide-rule-soft rounded-md border border-rule bg-paper text-sm shadow-md"
>
{findings.map((finding) => (
<CalloutEntry
Expand All @@ -99,14 +99,14 @@ function CalloutEntry({ finding, onAddress, onDecline }: CalloutEntryProps) {

return (
<div className="px-3 py-2.5">
<p className="font-medium text-stone-900">
<p className="font-medium text-ink">
<StruckText text={finding.issue} violations={violations} />
</p>
<p className="mt-0.5 text-stone-600">
<p className="mt-0.5 text-muted-ink">
<StruckText text={finding.diagnosis} violations={violations} />
</p>
{elsewhere.length > 0 && (
<p className="mt-1 text-xs text-stone-600">
<p className="mt-1 text-xs text-muted-ink">
Praise from the model: <StruckViolations violations={elsewhere} />
</p>
)}
Expand All @@ -129,7 +129,7 @@ function CalloutAction({ onClick, children }: { onClick: () => void; children: s
<button
type="button"
>
className="rounded font-medium text-stone-600 underline-offset-2 hover:text-stone-900 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stone-600"
className="rounded font-medium text-muted-ink underline-offset-2 hover:text-ink hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
{children}
</button>
Expand Down
0