Skip to content
Open
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
18 changes: 17 additions & 1 deletion src/deck/Annotator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ const TOOLS: { id: Tool; label: string; path: string }[] = [
},
];
const COLORS = ['var(--primary)', '#ffffff', '#ef4444', '#f5b73a', '#4aa8ff'];
const COLOR_LABELS: Record<string, string> = {
'var(--primary)': 'Accent',
'#ffffff': 'White',
'#ef4444': 'Red',
'#f5b73a': 'Amber',
'#4aa8ff': 'Blue',
};
const SIZES = [3, 6, 11];
const SIZE_LABELS = ['Small stroke', 'Medium stroke', 'Large stroke'];

const IconUndo = () => (
<svg
Expand Down Expand Up @@ -430,6 +438,8 @@ export default function Annotator({
key={t.id}
className={'ann-btn' + (tool === t.id ? ' on' : '')}
data-tip={t.label}
aria-label={t.label}
aria-pressed={tool === t.id}
onClick={() => setTool(t.id)}
>
<svg
Expand All @@ -450,16 +460,20 @@ export default function Annotator({
key={c}
className={'ann-color' + (color === c ? ' on' : '')}
data-tip="Color"
aria-label={(COLOR_LABELS[c] ?? 'Color') + ' pen'}
aria-pressed={color === c}
onClick={() => setColor(c)}
style={{ background: c }}
/>
))}
<span className="ann-sep" />
{SIZES.map((s) => (
{SIZES.map((s, i) => (
<button
key={s}
className={'ann-size' + (size === s ? ' on' : '')}
data-tip="Stroke size"
aria-label={SIZE_LABELS[i]}
aria-pressed={size === s}
onClick={() => setSize(s)}
>
<span style={{ width: s + 4, height: s + 4 }} />
Expand All @@ -469,6 +483,7 @@ export default function Annotator({
<button
className="ann-btn"
data-tip="Undo"
aria-label="Undo"
onClick={() => {
strokes.current = strokes.current.slice(0, -1);
commit();
Expand All @@ -479,6 +494,7 @@ export default function Annotator({
<button
className="ann-btn"
data-tip="Clear all"
aria-label="Clear all"
onClick={() => {
strokes.current = [];
commit();
Expand Down
12 changes: 12 additions & 0 deletions src/deck/Deck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ export default function Deck({ children }: { children: ReactNode }) {
<button
className="noir-icon-btn"
data-tip="Previous"
aria-label="Previous"
disabled={!hasPrev}
onClick={prev}
>
Expand All @@ -373,6 +374,7 @@ export default function Deck({ children }: { children: ReactNode }) {
<button
className="noir-icon-btn"
data-tip="Next"
aria-label="Next"
disabled={!hasNext}
onClick={next}
>
Expand Down Expand Up @@ -405,6 +407,7 @@ export default function Deck({ children }: { children: ReactNode }) {
<button
className="noir-icon-btn sm"
data-tip="Close"
aria-label="Close sidebar"
onClick={() => setRailOpen(false)}
>
<IconClose />
Expand Down Expand Up @@ -435,6 +438,7 @@ export default function Deck({ children }: { children: ReactNode }) {
<button
className="noir-icon-btn sm"
data-tip="Close"
aria-label="Close grid view"
onClick={() => setGridOpen(false)}
>
<IconClose />
Expand Down Expand Up @@ -491,13 +495,17 @@ export default function Deck({ children }: { children: ReactNode }) {
<button
className={'noir-icon-btn' + (railOpen ? ' on' : '')}
data-tip="Sidebar (S)"
aria-label="Sidebar"
aria-pressed={railOpen}
onClick={toggleRail}
>
<IconSidebar />
</button>
<button
className={'noir-icon-btn' + (gridOpen ? ' on' : '')}
data-tip="Grid view (G)"
aria-label="Grid view"
aria-pressed={gridOpen}
onClick={toggleGrid}
>
<IconGrid />
Expand All @@ -508,20 +516,24 @@ export default function Deck({ children }: { children: ReactNode }) {
<button
className={'noir-icon-btn' + (drawing ? ' on' : '')}
data-tip="Annotate (A)"
aria-label="Annotate"
aria-pressed={drawing}
onClick={() => setDrawing((v) => !v)}
>
<IconPencil />
</button>
<button
className="noir-icon-btn"
data-tip={fs ? 'Exit fullscreen (F)' : 'Fullscreen (F)'}
aria-label={fs ? 'Exit fullscreen' : 'Enter fullscreen'}
onClick={toggleFs}
>
{fs ? <IconShrink /> : <IconExpand />}
</button>
<button
className="noir-icon-btn"
data-tip="Presenter — new tab (P)"
aria-label="Open presenter view"
onClick={openPresenter}
>
<IconPresent />
Expand Down