rename useRootTheme to createRootTheme

This commit is contained in:
thislight 2024-11-25 14:53:46 +08:00
parent d55a117aa4
commit 62d3a5a3d0
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E
3 changed files with 19 additions and 18 deletions

View file

@ -10,7 +10,7 @@ import {
lazy, lazy,
onCleanup, onCleanup,
} from "solid-js"; } from "solid-js";
import { useRootTheme } from "./material/theme.js"; import { createRootTheme } from "./material/theme.js";
import { import {
Provider as ClientProvider, Provider as ClientProvider,
createMastoClientFor, createMastoClientFor,
@ -70,7 +70,7 @@ const Routing: Component = () => {
}; };
const App: Component = () => { const App: Component = () => {
const theme = useRootTheme(); const theme = createRootTheme();
const accts = useStore($accounts); const accts = useStore($accounts);
const lang = createCurrentLanguage(); const lang = createCurrentLanguage();
const region = createCurrentRegion(); const region = createCurrentRegion();

View file

@ -5,9 +5,8 @@ import { Accessor } from "solid-js";
/** /**
* The MUI theme. * The MUI theme.
*/ */
export function useRootTheme(): Accessor<Theme> { export function createRootTheme(): Accessor<Theme> {
return () => const theme = createTheme({
createTheme({
palette: { palette: {
primary: { primary: {
main: deepPurple[500], main: deepPurple[500],
@ -20,6 +19,8 @@ export function useRootTheme(): Accessor<Theme> {
}, },
}, },
}); });
return () => theme;
} }
export const ANIM_CURVE_STD = "cubic-bezier(0.4, 0, 0.2, 1)"; export const ANIM_CURVE_STD = "cubic-bezier(0.4, 0, 0.2, 1)";

View file

@ -16,7 +16,7 @@ import {
import { Close as CloseIcon, ContentCopy } from "@suid/icons-material"; import { Close as CloseIcon, ContentCopy } from "@suid/icons-material";
import { Title } from "~material/typography"; import { Title } from "~material/typography";
import { render } from "solid-js/web"; import { render } from "solid-js/web";
import { useRootTheme } from "~material/theme"; import { createRootTheme } from "~material/theme";
const ShareBottomSheet: Component<{ const ShareBottomSheet: Component<{
data?: ShareData; data?: ShareData;
@ -78,7 +78,7 @@ export async function share(data?: ShareData): Promise<void> {
const dispose = render(() => { const dispose = render(() => {
const [open, setOpen] = createSignal(true); const [open, setOpen] = createSignal(true);
const theme = useRootTheme(); const theme = createRootTheme();
onCleanup(() => { onCleanup(() => {
element.remove(); element.remove();
resolve(); resolve();