mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
🎨 Made color switcher change Mantine styles
Moved the color switcher's functions to a context provider and made Mantine's styles derived off of that context.
This commit is contained in:
@@ -7,6 +7,7 @@ import { Config } from '../tools/types';
|
||||
import { useConfig } from '../tools/state';
|
||||
import { migrateToIdConfig } from '../tools/migrate';
|
||||
import { getConfig } from '../tools/getConfig';
|
||||
import { useColorTheme } from '../tools/color';
|
||||
import Layout from '../components/layout/Layout';
|
||||
|
||||
export async function getServerSideProps({
|
||||
@@ -29,8 +30,11 @@ export async function getServerSideProps({
|
||||
export default function HomePage(props: any) {
|
||||
const { config: initialConfig }: { config: Config } = props;
|
||||
const { setConfig } = useConfig();
|
||||
const { setPrimaryColor, setSecondaryColor } = useColorTheme();
|
||||
useEffect(() => {
|
||||
const migratedConfig = migrateToIdConfig(initialConfig);
|
||||
setPrimaryColor(migratedConfig.settings.primaryColor || 'red');
|
||||
setSecondaryColor(migratedConfig.settings.secondaryColor || 'orange');
|
||||
setConfig(migratedConfig);
|
||||
}, [initialConfig]);
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user