Skip to content

Commit 3713f0c

Browse files
committed
improvements
1 parent acc9da9 commit 3713f0c

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

apps/probe-viewer/src/App.css

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,24 @@
418418
color: var(--accent-strong);
419419
}
420420

421+
/* Keyboard focus ring on the chip, since the real checkbox is visually hidden. */
422+
.viewer-toggle:has(input:focus-visible) {
423+
outline: 2px solid var(--accent);
424+
outline-offset: 2px;
425+
}
426+
427+
/* The checkbox stays in the DOM (and keyboard-focusable) for accessibility, but
428+
is visually hidden: the chip's pressed fill is what conveys on/off. */
421429
.viewer-toggle input {
422-
accent-color: var(--accent);
423-
margin: 0;
424-
cursor: pointer;
430+
position: absolute;
431+
width: 1px;
432+
height: 1px;
433+
padding: 0;
434+
margin: -1px;
435+
overflow: hidden;
436+
clip: rect(0 0 0 0);
437+
white-space: nowrap;
438+
border: 0;
425439
}
426440

427441
.viewer-canvas {

apps/probe-viewer/src/components/ProbeViewer.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ const JsonIcon = (
136136
</svg>
137137
);
138138

139+
// Leading icons for the view-toggle chips: an eye (show/hide contact IDs), an
140+
// I-beam matching the on-canvas scale bar, and a minimap frame for the overview.
141+
const EyeIcon = (
142+
<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
143+
<path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7-11-7-11-7z"/>
144+
<circle cx="12" cy="12" r="3"/>
145+
</svg>
146+
);
147+
148+
const ScaleBarIcon = (
149+
<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
150+
<line x1="3" y1="12" x2="21" y2="12"/>
151+
<line x1="3" y1="8" x2="3" y2="16"/>
152+
<line x1="21" y1="8" x2="21" y2="16"/>
153+
</svg>
154+
);
155+
156+
const MinimapIcon = (
157+
<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
158+
<rect x="3" y="3" width="18" height="18" rx="2"/>
159+
<rect x="13" y="13" width="6" height="6" rx="1"/>
160+
</svg>
161+
);
162+
139163
export function ProbeViewer() {
140164
const manifest = useAppStore((state) => state.manifest);
141165
const manifestStatus = useAppStore((state) => state.manifestStatus);
@@ -435,6 +459,7 @@ export function ProbeViewer() {
435459
checked={view.showContactIds}
436460
onChange={(event) => toggleContactIds(event.target.checked)}
437461
/>
462+
{EyeIcon}
438463
Show contact IDs
439464
</label>
440465
)}
@@ -444,6 +469,7 @@ export function ProbeViewer() {
444469
checked={view.showScaleBar}
445470
onChange={(event) => toggleScaleBar(event.target.checked)}
446471
/>
472+
{ScaleBarIcon}
447473
Scale bar
448474
</label>
449475
<label className="viewer-toggle">
@@ -452,6 +478,7 @@ export function ProbeViewer() {
452478
checked={view.showOverview}
453479
onChange={(event) => toggleOverview(event.target.checked)}
454480
/>
481+
{MinimapIcon}
455482
Overview
456483
</label>
457484
</section>

0 commit comments

Comments
 (0)