feat: add persistent responsive color themes

This commit is contained in:
donghyeon-ka
2026-07-26 00:06:49 +09:00
parent bee5c158c6
commit 4cfbe5a29e
9 changed files with 372 additions and 51 deletions
+21
View File
@@ -3,6 +3,7 @@ import { NavLink, Outlet, useLocation } from "react-router-dom";
import { NAVIGATION_ROUTES, routePath } from "../../contracts/routes.js";
import { useSession } from "../providers/session-provider.jsx";
import { useTheme } from "../providers/theme-provider.jsx";
const SESSION_LABELS = Object.freeze({
authenticated: "인증됨",
@@ -14,6 +15,7 @@ const SESSION_LABELS = Object.freeze({
export function AppShell() {
const location = useLocation();
const { sessionState, beginSignIn, signOut, recover } = useSession();
const { preference, setPreference } = useTheme();
const [navigationOpen, setNavigationOpen] = useState(false);
const [sessionActionPending, setSessionActionPending] = useState(false);
const [sessionActionFailed, setSessionActionFailed] = useState(false);
@@ -80,6 +82,25 @@ export function AppShell() {
Frontend Skeleton
</NavLink>
<div className="app-shell__session">
<label className="visually-hidden" htmlFor="theme-preference">
색상 테마
</label>
<select
className="theme-selector"
id="theme-preference"
value={preference}
onChange={(event) =>
setPreference(
/** @type {"system" | "light" | "dark"} */ (
event.currentTarget.value
),
)
}
>
<option value="system">시스템 테마</option>
<option value="light">라이트 테마</option>
<option value="dark">다크 테마</option>
</select>
<span className="session-status" data-state={sessionState}>
{SESSION_LABELS[sessionState]}
</span>