diff --git a/docs/spec.md b/docs/spec.md index fcc55fa..baaf240 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -175,6 +175,9 @@ Refer to `.env.example` for all variables. Key ones: - State management: Next Context or Zustand (no Redux unless necessary). - hls.js integration as per official docs. - Keep components small and reusable. +- Styling: Tailwind with **semantic tokens** defined in `src/app/globals.css` and wired in `tailwind.config.ts` (`bg-surface`, `text-content`, `border-line`, `accent`…). Don't hardcode raw palette colors in components — use token utilities so both themes stay consistent. +- Dark theme: `next-themes` (`attribute="class"` on ``), system preference by default, manual toggle in `src/components/ThemeToggle.tsx`. `color-scheme` flips per theme, so native controls follow. +- Shared UI primitives live in the component layer (`.surface`, `.btn`, `.input`, `.chip`, `.label`); reuse them instead of re-styling per page. --- diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ce52067..202243c 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "hls.js": "^1.5.7", "next": "14.2.5", + "next-themes": "^0.4.6", "react": "18.3.1", "react-dom": "18.3.1", "zustand": "^4.5.2" @@ -4137,6 +4138,16 @@ } } }, + "node_modules/next-themes": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.6.tgz", + "integrity": "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" + } + }, "node_modules/next/node_modules/postcss": { "version": "8.4.31", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", diff --git a/frontend/package.json b/frontend/package.json index 78f0254..c296774 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,10 +12,11 @@ "format:check": "prettier --check ." }, "dependencies": { + "hls.js": "^1.5.7", "next": "14.2.5", + "next-themes": "^0.4.6", "react": "18.3.1", "react-dom": "18.3.1", - "hls.js": "^1.5.7", "zustand": "^4.5.2" }, "devDependencies": { diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index a9a33d7..64403b6 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -2,9 +2,117 @@ @tailwind components; @tailwind utilities; +/* --------------------------------------------------------------------------- + Design tokens — RGB channels so Tailwind opacity modifiers work. + Light is the default; `.dark` (set by next-themes on ) flips every + value, so a single class like `bg-surface` is correct in both themes. +--------------------------------------------------------------------------- */ :root { color-scheme: light; + + --bg: 247 247 248; + --surface: 255 255 255; + --surface-muted: 244 244 245; + --surface-hover: 244 244 245; + --fg: 24 24 27; + --fg-muted: 82 82 91; + --fg-subtle: 161 161 170; + --border: 228 228 231; + --accent: 239 68 68; + --accent-hover: 220 38 38; + --accent-text: 220 38 38; + --accent-soft: 254 226 226; + --accent-fg: 255 255 255; + + --shadow-surface: 0 0 0 1px rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.06), + 0 4px 12px -2px rgb(0 0 0 / 0.06); + --shadow-surface-hover: 0 0 0 1px rgb(0 0 0 / 0.07), 0 2px 4px -1px rgb(0 0 0 / 0.08), + 0 12px 28px -8px rgb(0 0 0 / 0.14); +} + +.dark { + color-scheme: dark; + + --bg: 9 9 11; + --surface: 24 24 27; + --surface-muted: 39 39 42; + --surface-hover: 45 45 50; + --fg: 244 244 245; + --fg-muted: 161 161 170; + --fg-subtle: 113 113 122; + --border: 42 42 46; + --accent: 239 68 68; + --accent-hover: 248 113 113; + --accent-text: 248 113 113; + --accent-soft: 69 26 28; + --accent-fg: 255 255 255; + + --shadow-surface: 0 0 0 1px rgb(255 255 255 / 0.06); + --shadow-surface-hover: 0 0 0 1px rgb(255 255 255 / 0.1), 0 12px 28px -8px rgb(0 0 0 / 0.6); +} + +@layer base { + h1, + h2, + h3 { + text-wrap: balance; + } + p { + text-wrap: pretty; + } + /* Nice focus default for anything not using a component class. */ + :focus-visible { + outline: 2px solid rgb(var(--accent) / 0.6); + outline-offset: 2px; + } } + +@layer components { + /* Elevated surface with a hairline ring baked into the shadow. */ + .surface { + @apply rounded-2xl bg-surface shadow-surface transition-shadow duration-200; + } + .surface-hover:hover { + @apply shadow-surface-hover; + } + + .label { + @apply mb-1.5 block text-sm font-medium text-content; + } + + .input { + @apply w-full rounded-lg border border-line bg-surface px-3 py-2 text-sm text-content + placeholder:text-content-subtle transition-colors + focus:border-accent focus:outline-none focus:ring-2 focus:ring-accent/25; + } + + .chip { + @apply inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-xs font-medium text-content-muted; + } + + /* One button base; variants set the colour. Press feedback is 0.96 (skill). */ + .btn { + @apply inline-flex select-none items-center justify-center gap-2 whitespace-nowrap rounded-lg px-3.5 py-2 + text-sm font-medium transition-[background-color,border-color,color,box-shadow,transform] + duration-150 ease-out active:scale-[0.96] + focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/45 + focus-visible:ring-offset-2 focus-visible:ring-offset-bg + disabled:pointer-events-none disabled:opacity-50; + } + .btn-primary { + @apply bg-accent text-accent-fg shadow-[0_1px_2px_rgb(0_0_0/0.15)] hover:bg-accent-hover; + } + .btn-secondary { + @apply bg-surface text-content shadow-surface hover:shadow-surface-hover; + } + .btn-ghost { + @apply text-content-muted hover:bg-surface-muted hover:text-content; + } + .btn-danger { + @apply bg-red-600 text-white hover:bg-red-700; + } +} + body { - @apply bg-zinc-50 text-zinc-900 antialiased; + @apply bg-bg text-content antialiased; } diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index 8b27114..0a20712 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -1,7 +1,16 @@ import Header from "@/components/Header"; +import ScrollToTop from "@/components/ScrollToTop"; +import ThemeProvider from "@/components/ThemeProvider"; import type { Metadata } from "next"; +import { Inter } from "next/font/google"; import "./globals.css"; +const inter = Inter({ + subsets: ["latin", "cyrillic"], + display: "swap", + variable: "--font-inter", +}); + export const metadata: Metadata = { title: "Flowix — Video Streaming", description: "Open-source adaptive HLS platform", @@ -9,13 +18,19 @@ export const metadata: Metadata = { export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - -
-- No account? Register -
+Sign in to upload and manage your videos.
+ + + ++ No account?{" "} + + Register + +
+