Skip to content

Commit 5c9de3d

Browse files
samejrclaude
andcommitted
fix(webapp): notch the contrast mark against the real page colour
The mark's gap borders used background-bright, which is not what sits behind a settings row - the page there is background-dimmed, so the "gap" rendered as a slightly lighter stripe instead. Both colours now come from the slider variant, the line matches the track, and its ends are rounded. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 4c6ddfb commit 5c9de3d

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

apps/webapp/app/components/primitives/Slider.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const variants = {
1717
thumb:
1818
"h-4.5 w-4.5 border border-border-bright bg-white shadow-sm dark:border-transparent dark:bg-charcoal-200 dark:shadow-none",
1919
thumbSize: 18,
20+
// Track-coloured line, notched off the track by borders in the colour of
21+
// the page behind it (settings rows sit on background-dimmed).
22+
mark: "bg-grid-bright border-background-dimmed",
2023
},
2124
tertiary: {
2225
container: "h-6 gap-1 rounded-sm hover:bg-background-raised px-1",
@@ -27,6 +30,7 @@ const variants = {
2730
thumb:
2831
"h-3 w-3 border-2 border-text-dimmed bg-grid-bright shadow-[0_1px_3px_4px_rgb(0_0_0/0.2),0_1px_2px_-1px_rgb(0_0_0/0.1)] hover:border-text-dimmed focus:shadow-[0_1px_3px_4px_rgb(0_0_0/0.2),0_1px_2px_-1px_rgb(0_0_0/0.1)]",
2932
thumbSize: 12,
33+
mark: "bg-grid-bright border-background-dimmed",
3034
},
3135
};
3236

@@ -102,10 +106,13 @@ export function Slider({
102106
<span
103107
key={mark}
104108
aria-hidden
105-
// box-content keeps the line 1px wide and hangs the background-
106-
// coloured borders outside it, notching the track either side so
107-
// the mark reads in both themes.
108-
className="absolute top-1/2 box-content h-4 w-px -translate-x-1/2 -translate-y-1/2 border-x border-background-bright bg-text-dimmed"
109+
// Drawn after the track, so it sits on top of it. box-content
110+
// keeps the line 1px wide and hangs the borders outside it, so
111+
// they read as a gap in the track rather than eating the line.
112+
className={cn(
113+
"absolute top-1/2 box-content h-4 w-px -translate-x-1/2 -translate-y-1/2 rounded-full border-x",
114+
variation.mark
115+
)}
109116
style={{ left: `calc(${percent}% + ${offset}px)` }}
110117
/>
111118
);

0 commit comments

Comments
 (0)