🔀 Merge pull request #364 from wieli99/master

 Add option for custom CSS to Customization Settings
This commit is contained in:
Thomas Camlong
2022-08-31 15:56:07 +02:00
committed by GitHub
5 changed files with 24 additions and 3 deletions

View File

@@ -15,6 +15,10 @@
"label": "Hintergrund",
"placeholder": "/img/background.png"
},
"customCSS": {
"label": "Benutzerdefiniertes CSS",
"placeholder": "Benutzerdefiniertes CSS wird als letztes ausgeführt"
},
"buttons": {
"submit": "Absenden"
}

View File

@@ -15,6 +15,10 @@
"label": "Background",
"placeholder": "/img/background.png"
},
"customCSS": {
"label": "Custom CSS",
"placeholder": "Custom CSS will be executed last"
},
"buttons": {
"submit": "Submit"
}

View File

@@ -1,4 +1,4 @@
import { TextInput, Button, Stack } from '@mantine/core';
import { TextInput, Button, Stack, Textarea } from '@mantine/core';
import { useForm } from '@mantine/form';
import { useTranslation } from 'next-i18next';
import { useConfig } from '../../tools/state';
@@ -17,6 +17,7 @@ export default function TitleChanger() {
logo: config.settings.logo,
favicon: config.settings.favicon,
background: config.settings.background,
customCSS: config.settings.customCSS,
},
});
@@ -25,6 +26,7 @@ export default function TitleChanger() {
logo?: string;
favicon?: string;
background?: string;
customCSS?: string;
}) => {
setConfig({
...config,
@@ -34,6 +36,7 @@ export default function TitleChanger() {
logo: values.logo,
favicon: values.favicon,
background: values.background,
customCSS: values.customCSS,
},
});
};
@@ -62,6 +65,12 @@ export default function TitleChanger() {
placeholder={t('background.placeholder')}
{...form.getInputProps('background')}
/>
<Textarea
minRows={5}
label={t('customCSS.label')}
placeholder={t('customCSS.placeholder')}
{...form.getInputProps('customCSS')}
/>
<Button type="submit">{t('buttons.submit')}</Button>
</Stack>
</form>

View File

@@ -34,6 +34,9 @@ export default function Layout({ children, style }: any) {
>
{children}
</main>
<style>
{cx(config.settings.customCSS)}
</style>
</AppShell>
);
}

View File

@@ -10,6 +10,7 @@ export interface Settings {
secondaryColor?: MantineTheme['primaryColor'];
primaryShade?: MantineTheme['primaryShade'];
background?: string;
customCSS?: string,
appOpacity?: number;
widgetPosition?: string;
appCardWidth?: number;