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

View file

@ -5,21 +5,22 @@ import { Accessor } from "solid-js";
/**
* The MUI theme.
*/
export function useRootTheme(): Accessor<Theme> {
return () =>
createTheme({
palette: {
primary: {
main: deepPurple[500],
},
error: {
main: red[900],
},
secondary: {
main: amber.A200,
},
export function createRootTheme(): Accessor<Theme> {
const theme = createTheme({
palette: {
primary: {
main: deepPurple[500],
},
});
error: {
main: red[900],
},
secondary: {
main: amber.A200,
},
},
});
return () => theme;
}
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 { Title } from "~material/typography";
import { render } from "solid-js/web";
import { useRootTheme } from "~material/theme";
import { createRootTheme } from "~material/theme";
const ShareBottomSheet: Component<{
data?: ShareData;
@ -78,7 +78,7 @@ export async function share(data?: ShareData): Promise<void> {
const dispose = render(() => {
const [open, setOpen] = createSignal(true);
const theme = useRootTheme();
const theme = createRootTheme();
onCleanup(() => {
element.remove();
resolve();