refactor(SliderArea): extract grid overlay into bg-grid utilities
Workflow / build (pull_request) Successful in 37s
Workflow / publish (pull_request) Has been skipped

The decorative dotted-grid background on the paper surface was a
6-line $derived gridStyle string applied via inline style="" plus four
extra utility classes for color and opacity. Replace with two named
utilities and let CSS handle the responsive switch.

app.css:
- New --color-grid-line CSS var (light + dark) so the grid colour and
  intensity auto-switch without consumers needing a dark: variant or an
  opacity layer.
- @utility bg-grid (20px cells) and @utility bg-grid-sm (10px cells).
  Both reference --color-grid-line, so the same markup paints correctly
  in light and dark mode.

SliderArea.svelte:
- Drop the gridStyle $derived block and the inline style= attribute.
- Overlay becomes a single line:
  <div class="absolute inset-0 pointer-events-none bg-grid-sm md:bg-grid"
       aria-hidden="true" />
  Mobile picks the tight 10px grid; the md: breakpoint flips to 20px,
  matching the prior JS-driven behaviour with no extra runtime cost.
This commit is contained in:
Ilia Mashkov
2026-05-25 11:09:26 +03:00
parent ffc28f78f5
commit 4126275c4d
2 changed files with 23 additions and 3 deletions
+21
View File
@@ -19,6 +19,7 @@
--color-border-subtle: var(--neutral-300);
--color-text-subtle: var(--neutral-500);
--color-skeleton: var(--neutral-200);
--color-grid-line: rgb(0 0 0 / 0.03);
/* Neutral Grays */
--neutral-50: #fafafa;
@@ -114,6 +115,7 @@
--color-border-subtle: rgb(255 255 255 / 0.1);
--color-text-subtle: var(--neutral-400);
--color-skeleton: var(--neutral-800);
--color-grid-line: rgb(255 255 255 / 0.05);
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
@@ -401,6 +403,25 @@
background-color: color-mix(in srgb, var(--color-skeleton) 70%, transparent);
}
/* Subtle dotted-grid overlay used as a decorative background on the
comparison paper surface. Color and intensity auto-switch via
--color-grid-line. `bg-grid-sm` uses a tighter cell — typical mobile
choice; `bg-grid` is the default desktop cell. Pair with absolute /
pointer-events-none on the overlay element. */
@utility bg-grid {
background-image:
linear-gradient(var(--color-grid-line) 1px, transparent 1px),
linear-gradient(90deg, var(--color-grid-line) 1px, transparent 1px);
background-size: 20px 20px;
}
@utility bg-grid-sm {
background-image:
linear-gradient(var(--color-grid-line) 1px, transparent 1px),
linear-gradient(90deg, var(--color-grid-line) 1px, transparent 1px);
background-size: 10px 10px;
}
/* ── Typography ───────────────────────────────────────────────── */
@utility text-label-mono {