mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 23:45:48 +01:00
Style settings customization and opacity selector
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { Button, ScrollArea, Stack } from '@mantine/core';
|
import { Button, ScrollArea, Stack } from '@mantine/core';
|
||||||
|
import { useViewportSize } from '@mantine/hooks';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
import { useConfigContext } from '../../../config/provider';
|
import { useConfigContext } from '../../../config/provider';
|
||||||
import { useConfigStore } from '../../../config/store';
|
import { useConfigStore } from '../../../config/store';
|
||||||
@@ -16,20 +17,13 @@ import { ShadeSelector } from './Theme/ShadeSelector';
|
|||||||
export default function CustomizationSettings() {
|
export default function CustomizationSettings() {
|
||||||
const { config, name: configName } = useConfigContext();
|
const { config, name: configName } = useConfigContext();
|
||||||
const { t } = useTranslation('common');
|
const { t } = useTranslation('common');
|
||||||
|
const { height, width } = useViewportSize();
|
||||||
|
|
||||||
const { updateConfig } = useConfigStore();
|
const { updateConfig } = useConfigStore();
|
||||||
|
|
||||||
const saveConfiguration = () => {
|
|
||||||
if (!configName || !config) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateConfig(configName, (_) => config, false, true);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack mt="xs" spacing={0}>
|
<ScrollArea style={{ height: height - 100 }} offsetScrollbars>
|
||||||
<ScrollArea style={{ height: '78vh' }} offsetScrollbars>
|
<Stack mt="xs" mb="md" spacing="xs">
|
||||||
<LayoutSelector defaultLayout={config?.settings.customization.layout} />
|
<LayoutSelector defaultLayout={config?.settings.customization.layout} />
|
||||||
<PageTitleChanger defaultValue={config?.settings.customization.pageTitle} />
|
<PageTitleChanger defaultValue={config?.settings.customization.pageTitle} />
|
||||||
<MetaTitleChanger defaultValue={config?.settings.customization.metaTitle} />
|
<MetaTitleChanger defaultValue={config?.settings.customization.metaTitle} />
|
||||||
@@ -47,11 +41,7 @@ export default function CustomizationSettings() {
|
|||||||
/>
|
/>
|
||||||
<ShadeSelector defaultValue={config?.settings.customization.colors.shade} />
|
<ShadeSelector defaultValue={config?.settings.customization.colors.shade} />
|
||||||
<OpacitySelector defaultValue={config?.settings.customization.appOpacity} />
|
<OpacitySelector defaultValue={config?.settings.customization.appOpacity} />
|
||||||
</ScrollArea>
|
|
||||||
|
|
||||||
<Button onClick={saveConfiguration} variant="filled">
|
|
||||||
{t('common:save')}
|
|
||||||
</Button>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
|
</ScrollArea>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export function OpacitySelector({ defaultValue }: OpacitySelectorProps) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack spacing="xs">
|
<Stack spacing="xs" mb="md">
|
||||||
<Text>{t('label')}</Text>
|
<Text>{t('label')}</Text>
|
||||||
<Slider
|
<Slider
|
||||||
defaultValue={opacity}
|
defaultValue={opacity}
|
||||||
|
|||||||
Reference in New Issue
Block a user