From 65afb292747b0e57865bc4c0d5df320fbc58b261 Mon Sep 17 00:00:00 2001 From: Fringg Date: Wed, 25 Feb 2026 07:57:56 +0300 Subject: [PATCH] fix: boxes background not covering viewport - Use 300% oversized CSS grid container instead of fixed-size flex cells - Grid with 1fr units auto-fills the container, skew+scale covers viewport - Simplified to flat cell array, removed SVG crosses for cleaner look --- .../ui/backgrounds/background-boxes.tsx | 84 ++++++++----------- 1 file changed, 35 insertions(+), 49 deletions(-) diff --git a/src/components/ui/backgrounds/background-boxes.tsx b/src/components/ui/backgrounds/background-boxes.tsx index 0f000dc..766b6fd 100644 --- a/src/components/ui/backgrounds/background-boxes.tsx +++ b/src/components/ui/backgrounds/background-boxes.tsx @@ -18,23 +18,19 @@ const COLORS = [ ]; export default React.memo(function BackgroundBoxes({ settings }: Props) { - const rows = clampNumber(settings.rows, 4, 30, 20); - const cols = clampNumber(settings.cols, 4, 30, 12); + const rows = clampNumber(settings.rows, 4, 30, 15); + const cols = clampNumber(settings.cols, 4, 30, 15); const boxColor = sanitizeColor(settings.boxColor, '#818cf8'); - const grid = useMemo(() => { - const result: { color: string; delay: number; duration: number }[][] = []; - for (let i = 0; i < rows; i++) { - const row: { color: string; delay: number; duration: number }[] = []; - for (let j = 0; j < cols; j++) { - row.push({ - color: - boxColor === '#818cf8' ? COLORS[Math.floor(Math.random() * COLORS.length)] : boxColor, - delay: Math.random() * 8, - duration: 3 + Math.random() * 4, - }); - } - result.push(row); + const cells = useMemo(() => { + const result: { color: string; delay: number; duration: number }[] = []; + for (let i = 0; i < rows * cols; i++) { + result.push({ + color: + boxColor === '#818cf8' ? COLORS[Math.floor(Math.random() * COLORS.length)] : boxColor, + delay: Math.random() * 8, + duration: 3 + Math.random() * 4, + }); } return result; }, [rows, cols, boxColor]); @@ -42,43 +38,33 @@ export default React.memo(function BackgroundBoxes({ settings }: Props) { return (
- {grid.map((row, i) => ( -
- {row.map((cell, j) => ( - - {j % 2 === 0 && i % 2 === 0 && ( - - - - )} - - ))} -
+ {cells.map((cell, i) => ( + ))}