feat: complete CSS theme system with light/dark/system support

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-02 18:31:26 -05:00
parent 6cee145135
commit a874c0221f
2 changed files with 642 additions and 0 deletions

50
src/style/css.test.ts Normal file
View File

@@ -0,0 +1,50 @@
import { describe, it, expect } from "vitest";
import { getCSS } from "./css";
describe("getCSS", () => {
const css = getCSS();
it("returns a non-empty string", () => {
expect(css.length).toBeGreaterThan(0);
});
it("includes light theme variables", () => {
expect(css).toContain("--bg:");
expect(css).toContain("#fafafa");
});
it("includes dark theme variables", () => {
expect(css).toContain("#111214");
});
it("includes system theme media query", () => {
expect(css).toContain("prefers-color-scheme: dark");
});
it("includes data-theme selectors for light and dark", () => {
expect(css).toContain('[data-theme="light"]');
expect(css).toContain('[data-theme="dark"]');
expect(css).toContain('[data-theme="system"]');
});
it("includes live-now animation", () => {
expect(css).toContain("@keyframes pulse");
expect(css).toContain(".is-live");
});
it("includes responsive breakpoint", () => {
expect(css).toContain("768px");
});
it("includes grid layout rules", () => {
expect(css).toContain(".week-grid");
});
it("includes VCR badge styles", () => {
expect(css).toContain(".vcr-badge");
});
it("uses system font stack", () => {
expect(css).toContain("-apple-system");
});
});

592
src/style/css.ts Normal file
View File

@@ -0,0 +1,592 @@
const LIGHT_VARS = `
--bg: #fafafa;
--bg-surface: #ffffff;
--text: #1a1a1a;
--text-muted: #666666;
--border: #e0e0e0;
--grid-line: #eeeeee;
--today-highlight: rgba(0, 0, 0, 0.03);
--live-pulse: #ff3b3b;
`;
const DARK_VARS = `
--bg: #111214;
--bg-surface: #1a1c1e;
--text: #e8e8e8;
--text-muted: #999999;
--border: #2a2c2e;
--grid-line: #222426;
--today-highlight: rgba(255, 255, 255, 0.03);
--live-pulse: #ff4d4d;
`;
export function getCSS(): string {
return `/* VCR Calendar */
*, *::before, *::after {
box-sizing: border-box;
}
* {
margin: 0;
padding: 0;
}
html {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
font-size: 16px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
body {
background: var(--bg);
color: var(--text);
min-height: 100vh;
}
a {
color: inherit;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
:root {
${LIGHT_VARS}
}
[data-theme="light"] {
${LIGHT_VARS}
}
[data-theme="dark"] {
${DARK_VARS}
}
[data-theme="system"] {
${LIGHT_VARS}
}
@media (prefers-color-scheme: dark) {
[data-theme="system"] {
${DARK_VARS}
}
}
/* Site header & footer */
.site-header {
background: var(--bg-surface);
border-bottom: 1px solid var(--border);
padding: 1rem 1.25rem;
}
.site-header__title {
font-size: 1.25rem;
font-weight: 600;
}
.site-header__title a:hover {
text-decoration: none;
}
.site-footer {
border-top: 1px solid var(--border);
padding: 1.5rem 1.25rem;
color: var(--text-muted);
font-size: 0.875rem;
text-align: center;
}
/* Page layout */
.page-container {
max-width: 1400px;
margin: 0 auto;
padding: 1rem 1.25rem 2rem;
}
.controls-bar {
background: var(--bg-surface);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.75rem 1rem;
margin-bottom: 1.25rem;
}
.controls-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem 1.25rem;
}
.controls-row + .controls-row {
margin-top: 0.75rem;
padding-top: 0.75rem;
border-top: 1px solid var(--border);
}
.controls-label {
font-size: 0.8125rem;
color: var(--text-muted);
font-weight: 500;
}
.controls-group {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.35rem 0.5rem;
}
/* Mode toggle */
.mode-link {
padding: 0.25rem 0.65rem;
border-radius: 4px;
font-size: 0.875rem;
color: var(--text-muted);
}
.mode-link:hover {
background: var(--today-highlight);
text-decoration: none;
}
.mode-link--active {
font-weight: 600;
color: var(--text);
background: var(--today-highlight);
}
/* Theme toggle */
.theme-link {
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.875rem;
color: var(--text-muted);
}
.theme-link:hover {
background: var(--today-highlight);
text-decoration: none;
}
.theme-link--active {
font-weight: 600;
color: var(--text);
}
.controls-reset {
font-size: 0.8125rem;
color: var(--text-muted);
margin-left: auto;
}
/* Timezone picker */
.tz-link {
padding: 0.2rem 0.45rem;
border-radius: 4px;
font-size: 0.875rem;
color: var(--text-muted);
}
.tz-link:hover {
color: var(--text);
text-decoration: none;
}
.tz-link--active {
font-weight: 600;
color: var(--text);
}
.tz-separator {
color: var(--border);
user-select: none;
}
/* Week navigation */
.week-nav {
display: flex;
align-items: center;
gap: 1rem;
flex: 1;
justify-content: center;
}
.week-nav__link {
font-size: 0.875rem;
color: var(--text-muted);
white-space: nowrap;
}
.week-nav__link:hover {
color: var(--text);
}
.week-label {
font-weight: 600;
font-size: 1rem;
white-space: nowrap;
}
/* Week grid */
.week-grid-wrapper {
overflow-x: auto;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--bg-surface);
}
.week-grid {
display: grid;
grid-template-columns: auto repeat(7, minmax(0, 1fr));
grid-auto-rows: 2rem;
min-width: 100%;
}
.week-grid__gutter {
position: sticky;
left: 0;
z-index: 2;
background: var(--bg-surface);
border-right: 1px solid var(--grid-line);
padding: 0 0.5rem;
font-size: 0.75rem;
color: var(--text-muted);
display: flex;
align-items: flex-start;
justify-content: flex-end;
padding-top: 0.25rem;
}
.week-grid__day-header {
text-align: center;
font-size: 0.8125rem;
font-weight: 600;
padding: 0.5rem 0.25rem;
border-bottom: 1px solid var(--grid-line);
border-right: 1px solid var(--grid-line);
background: var(--bg-surface);
}
.week-grid__day-header:last-child {
border-right: none;
}
.week-grid__cell {
border-right: 1px solid var(--grid-line);
border-bottom: 1px solid var(--grid-line);
min-height: 2rem;
}
.week-grid__cell:nth-child(8n) {
border-right: none;
}
.day-today {
background: var(--today-highlight);
}
/* Show blocks */
.show-block {
display: flex;
flex-direction: column;
gap: 0.125rem;
padding: 0.35rem 0.5rem 0.35rem 0.45rem;
margin: 1px 2px;
border-left: 4px solid var(--show-accent, var(--border));
background: var(--show-bg, var(--today-highlight));
border-radius: 4px;
overflow: hidden;
font-size: 0.8125rem;
line-height: 1.3;
z-index: 1;
transition: filter 0.15s ease, box-shadow 0.15s ease;
}
.show-block:hover {
filter: brightness(0.97);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
text-decoration: none;
}
.show-block__name {
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: flex;
align-items: center;
gap: 0.35rem;
}
.show-block__time {
font-size: 0.6875rem;
color: var(--text-muted);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.show-block__meta {
display: flex;
align-items: center;
gap: 0.35rem;
flex-wrap: wrap;
}
/* Live-now indicator */
@keyframes pulse {
0%, 100% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.6;
transform: scale(1.3);
}
}
.is-live::before {
content: "";
display: inline-block;
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--live-pulse);
animation: pulse 2s ease-in-out infinite;
flex-shrink: 0;
}
/* VCR badge */
.vcr-badge {
display: inline-block;
padding: 0.1rem 0.4rem;
border-radius: 999px;
background: #1a1a1a;
color: #f0f0f0;
font-size: 11px;
font-variant: small-caps;
letter-spacing: 0.04em;
line-height: 1.4;
vertical-align: middle;
}
[data-theme="dark"] .vcr-badge,
[data-theme="system"] .vcr-badge {
background: #2a2c2e;
color: #e8e8e8;
}
@media (prefers-color-scheme: dark) {
[data-theme="system"] .vcr-badge {
background: #2a2c2e;
color: #e8e8e8;
}
}
/* Biweekly label */
.biweekly-label {
font-size: 0.6875rem;
color: var(--text-muted);
font-style: italic;
}
/* Agenda */
.agenda {
margin-top: 2rem;
}
.agenda__heading {
font-size: 1.125rem;
font-weight: 600;
margin-bottom: 1rem;
}
.agenda-day {
margin-bottom: 1.5rem;
}
.agenda-day__heading {
font-size: 1rem;
font-weight: 600;
padding-bottom: 0.5rem;
margin-bottom: 0.5rem;
border-bottom: 1px solid var(--border);
}
.agenda-entry {
display: block;
padding: 0.65rem 0.75rem 0.65rem 0.85rem;
margin-bottom: 0.35rem;
border-left: 4px solid var(--show-accent, var(--border));
background: var(--bg-surface);
border-radius: 0 4px 4px 0;
border: 1px solid var(--border);
border-left-width: 4px;
border-left-color: var(--show-accent, var(--border));
}
.agenda-entry:hover {
background: var(--today-highlight);
text-decoration: none;
}
.agenda-entry__time {
font-size: 0.8125rem;
color: var(--text-muted);
margin-bottom: 0.2rem;
}
.agenda-entry__name {
font-weight: 500;
display: flex;
align-items: center;
gap: 0.35rem;
flex-wrap: wrap;
}
/* Show detail page */
.show-detail {
max-width: 42rem;
}
.show-detail__heading {
font-size: 1.75rem;
font-weight: 600;
padding-top: 0.75rem;
border-top: 4px solid var(--show-accent, var(--border));
margin-bottom: 0.75rem;
}
.show-detail__schedule {
color: var(--text-muted);
font-size: 1rem;
margin-bottom: 1rem;
}
.show-detail__hosts {
margin-bottom: 1rem;
font-size: 0.9375rem;
}
.show-detail__description {
margin-bottom: 1.5rem;
line-height: 1.6;
}
.show-detail__links {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin-bottom: 1.5rem;
}
.show-detail__links a {
color: var(--text);
text-decoration: underline;
text-underline-offset: 2px;
}
.show-detail__badges {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin-bottom: 1.5rem;
}
.show-detail__badge {
display: inline-block;
padding: 0.2rem 0.6rem;
border-radius: 4px;
font-size: 0.8125rem;
background: var(--today-highlight);
border: 1px solid var(--border);
}
.show-detail__back {
font-size: 0.9375rem;
color: var(--text-muted);
}
.show-detail__back:hover {
color: var(--text);
}
/* 404 page */
.not-found {
text-align: center;
padding: 4rem 1.5rem;
}
.not-found__code {
font-size: 4rem;
font-weight: 700;
color: var(--text-muted);
line-height: 1;
margin-bottom: 0.5rem;
}
.not-found__message {
font-size: 1.125rem;
color: var(--text-muted);
margin-bottom: 1.5rem;
}
.not-found__link {
font-size: 0.9375rem;
text-decoration: underline;
text-underline-offset: 2px;
}
/* Responsive */
@media (max-width: 768px) {
.week-grid-wrapper {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.week-grid {
grid-template-columns: 3.5rem repeat(7, 120px);
min-width: max-content;
}
.week-grid__day-header,
.week-grid__cell {
min-width: 120px;
}
.controls-row {
flex-direction: column;
align-items: flex-start;
}
.week-nav {
justify-content: flex-start;
width: 100%;
}
.controls-reset {
margin-left: 0;
}
}
`;
}