atproto explorer pdsls.dev
atproto tool

move theme selection to settings page

juli.ee 1253184c 7950db0e

verified
Changed files
+17 -11
src
components
views
+13 -8
src/components/theme.tsx
···
else localStorage.theme = newTheme;
};
-
const ThemeButton = (props: { theme: string; icon: string }) => {
+
const ThemeOption = (props: { theme: string; icon: string; label: string }) => {
return (
<button
classList={{
-
"p-1.5 flex items-center rounded-full border-[0.5px]": true,
-
"bg-neutral-200/60 border-neutral-300/60 dark:border-neutral-500/60 dark:bg-neutral-600":
+
"flex items-center gap-2 rounded-xl border px-3 py-2": true,
+
"bg-neutral-200/60 border-neutral-300 dark:border-neutral-500 dark:bg-neutral-700":
theme() === props.theme,
-
"border-transparent": theme() !== props.theme,
+
"border-neutral-200 dark:border-neutral-600 hover:bg-neutral-100 dark:hover:bg-neutral-800":
+
theme() !== props.theme,
}}
onclick={() => updateTheme(props.theme)}
>
<span class={"iconify " + props.icon}></span>
+
<span>{props.label}</span>
</button>
);
};
return (
-
<div class="dark:bg-dark-100 dark:inset-shadow-dark-200 mt-2 flex items-center justify-between gap-1 rounded-full border-[0.5px] border-neutral-200/60 bg-white p-1 text-base text-neutral-800 inset-shadow-sm dark:border-neutral-600 dark:text-neutral-300">
-
<ThemeButton theme="system" icon="lucide--monitor" />
-
<ThemeButton theme="light" icon="lucide--sun" />
-
<ThemeButton theme="dark" icon="lucide--moon" />
+
<div class="flex flex-col gap-0.5">
+
<label class="select-none">Theme</label>
+
<div class="flex gap-2">
+
<ThemeOption theme="system" icon="lucide--monitor" label="System" />
+
<ThemeOption theme="light" icon="lucide--sun" label="Light" />
+
<ThemeOption theme="dark" icon="lucide--moon" label="Dark" />
+
</div>
</div>
);
};
+1 -2
src/layout.tsx
···
import { NavBar } from "./components/navbar.jsx";
import { NotificationContainer } from "./components/notification.jsx";
import { Search, SearchButton, showSearch } from "./components/search.jsx";
-
import { themeEvent, ThemeSelection } from "./components/theme.jsx";
+
import { themeEvent } from "./components/theme.jsx";
import { resolveHandle } from "./utils/api.js";
export const isTouchDevice = "ontouchstart" in window || navigator.maxTouchPoints > 1;
···
newTab
external
/>
-
<ThemeSelection />
</DropdownMenu>
</MenuProvider>
</div>
+3 -1
src/views/settings.tsx
···
import { createSignal } from "solid-js";
import { TextInput } from "../components/text-input.jsx";
+
import { ThemeSelection } from "../components/theme.jsx";
export const [hideMedia, setHideMedia] = createSignal(localStorage.hideMedia === "true");
···
<div class="flex items-center gap-1 font-semibold">
<span>Settings</span>
</div>
-
<div class="flex flex-col gap-2">
+
<div class="flex flex-col gap-3">
<div class="flex flex-col gap-0.5">
<label for="plcDirectory" class="select-none">
PLC Directory
···
}}
/>
</div>
+
<ThemeSelection />
<div class="flex justify-between">
<div class="flex items-center gap-1">
<input