dvorakmortonxd.dev/src/app/components/ThemeRoot.tsx

25 lines
821 B
TypeScript

"use client";
import { useTheme } from "./useTheme";
import EditorialSite from "./EditorialSite";
import WindowsDesktop from "./WindowsDesktop";
// The web editorial site is the default and always the landing view (the theme
// is not persisted). Phones can never reach the KDE desktop: the Desktop-mode
// buttons are hidden there, so `theme === "skeuo"` only happens on desktop.
//
// The editorial page stays mounted (hidden) while the desktop is up, so its
// scroll position survives a round-trip. The desktop mounts on demand.
export default function ThemeRoot() {
const { theme } = useTheme();
const desktop = theme === "skeuo";
return (
<>
<div style={desktop ? { display: "none" } : undefined}>
<EditorialSite />
</div>
{desktop ? <WindowsDesktop /> : null}
</>
);
}