diff --git a/src/App.css b/src/App.css index 2946455..47e1678 100644 --- a/src/App.css +++ b/src/App.css @@ -8,8 +8,9 @@ .app { display: flex; flex-direction: column; - align-items: center; + align-items: stretch; min-height: 100vh; + width: 100%; padding-top: 40px; box-sizing: border-box; } @@ -25,6 +26,7 @@ z-index: 10; flex-shrink: 0; margin-bottom: 60px; + align-self: center; } .clock-container { @@ -33,14 +35,12 @@ align-items: center; flex: 1; width: 100%; - padding: 0 20px; box-sizing: border-box; } /* Digital clock style (default) */ .digital-clock { font-family: 'DSEG7', monospace; - font-size: clamp(48px, 15vw, 180px); font-weight: bold; color: #fff; text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); @@ -72,10 +72,6 @@ /* Responsive adjustments */ @media (max-width: 768px) { - .digital-clock { - font-size: 12vw; - } - .style-selector { gap: 8px; } diff --git a/src/App.tsx b/src/App.tsx index 3c1b4be..85e5d6f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,9 +5,20 @@ import './App.css' type ClockStyle = 'digital' | 'flip' | 'roll' -function DigitalClock({ time }: { time: string }) { +function DigitalClock({ time, size }: { time: string; size: number }) { + // Match width with flip/roll clocks + // Total flip/roll width ≈ 5.1 * (size / 1.6) because size is now scaled + // Actually size passed in is already the final size + // Flip: 6 * (size * 0.75) + 2 * (size * 0.3) = 4.5 * size + 0.6 * size = 5.1 * size + // Digital: 8 chars, each char ≈ fontSize * 0.6 wide in monospace = 4.8 * fontSize + // To match: 4.8 * fontSize = 5.1 * size => fontSize = size * 1.06 + const fontSize = Math.floor(size * 1.06) + return ( -
+
{time}
) @@ -25,19 +36,14 @@ function App() { return () => clearInterval(timer) }, []) - // Responsive clock size + // Responsive clock size - target 90% of page width useEffect(() => { const updateSize = () => { const width = window.innerWidth - if (width < 480) { - setClockSize(Math.floor(width / 8)) - } else if (width < 768) { - setClockSize(Math.floor(width / 7)) - } else if (width < 1024) { - setClockSize(100) - } else { - setClockSize(120) - } + // Direct calculation: target 90% width + const baseSize = (width * 0.9) / 5.1 + const newSize = Math.floor(baseSize * 2.0) // Scale up more + setClockSize(Math.min(newSize, 320)) } updateSize() window.addEventListener('resize', updateSize) @@ -54,7 +60,7 @@ function App() { return case 'digital': default: - return + return } } diff --git a/src/index.css b/src/index.css index a3d1805..21dcceb 100644 --- a/src/index.css +++ b/src/index.css @@ -51,11 +51,9 @@ } #root { - width: 1126px; - max-width: 100%; + width: 100%; margin: 0 auto; text-align: center; - border-inline: 1px solid var(--border); min-height: 100svh; display: flex; flex-direction: column;