mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 22:16:54 +00:00
improve settings hook
This commit is contained in:
1 parent
362ab8be4d
commit
26cf051696
2 files changed
+18
-17
No files matched your search
+14
-16
@@ -11,23 +11,21 @@ import MessageIcon from "@material-ui/icons/Email";
|
||||
import { HomeApp } from "./apps/home/components/Home";
|
||||
import { ContactsApp } from "./apps/contacts/components/Contacts";
|
||||
import { SettingsApp } from "./apps/settings/components/Settings";
|
||||
import { ThemeProvider, createMuiTheme } from "@material-ui/core";
|
||||
import { useConfig } from "./config/hooks/useConfig";
|
||||
import { ThemeProvider } from "@material-ui/core";
|
||||
|
||||
function Phone() {
|
||||
const { settings } = useSettings();
|
||||
const [config] = useConfig();
|
||||
const { settings, currentTheme } = useSettings();
|
||||
return (
|
||||
<div className="PhoneWrapper">
|
||||
<div style={{ zoom: "80%" }}>
|
||||
<div className="Phone">
|
||||
<div
|
||||
className="PhoneFrame"
|
||||
style={{
|
||||
backgroundImage: `${process.env.PUBLIC_URL}url(/media/frames/${settings.frame})`,
|
||||
}}
|
||||
></div>
|
||||
<ThemeProvider theme={createMuiTheme(config.themes[settings.theme])}>
|
||||
<ThemeProvider theme={currentTheme()}>
|
||||
<div className="PhoneWrapper">
|
||||
<div style={{ zoom: "80%" }}>
|
||||
<div className="Phone">
|
||||
<div
|
||||
className="PhoneFrame"
|
||||
style={{
|
||||
backgroundImage: `${process.env.PUBLIC_URL}url(/media/frames/${settings.frame})`,
|
||||
}}
|
||||
></div>
|
||||
<div
|
||||
id="phone"
|
||||
className="PhoneScreen"
|
||||
@@ -45,10 +43,10 @@ function Phone() {
|
||||
</div>
|
||||
<NavigationBar />
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Default from "../default.json";
|
||||
import { useConfig } from "../../../config/hooks/useConfig";
|
||||
import { atom } from "recoil";
|
||||
import { createMuiTheme } from "@material-ui/core";
|
||||
|
||||
const settingsState = atom({
|
||||
key: "settings",
|
||||
@@ -9,5 +10,7 @@ const settingsState = atom({
|
||||
|
||||
export const useSettings = () => {
|
||||
const [settings, setSettings] = useConfig(settingsState);
|
||||
return { settings, setSettings };
|
||||
const [config] = useConfig();
|
||||
const currentTheme = () => createMuiTheme(config.themes[settings.theme]);
|
||||
return { settings, setSettings, currentTheme };
|
||||
};
|
||||
Reference in new issue
Block a user