mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-06 21:45:47 +01:00
✨ Added a background image input
Added an input in the advanced options for a background image. Also removed an unused import from my previous commit and changed the margin on the header bar to padding instead.
This commit is contained in:
@@ -10,10 +10,16 @@ export default function TitleChanger() {
|
||||
title: config.settings.title,
|
||||
logo: config.settings.logo,
|
||||
favicon: config.settings.favicon,
|
||||
background: config.settings.background,
|
||||
},
|
||||
});
|
||||
|
||||
const saveChanges = (values: { title?: string; logo?: string; favicon?: string }) => {
|
||||
const saveChanges = (values: {
|
||||
title?: string;
|
||||
logo?: string;
|
||||
favicon?: string;
|
||||
background?: string;
|
||||
}) => {
|
||||
setConfig({
|
||||
...config,
|
||||
settings: {
|
||||
@@ -21,6 +27,7 @@ export default function TitleChanger() {
|
||||
title: values.title,
|
||||
logo: values.logo,
|
||||
favicon: values.favicon,
|
||||
background: values.background,
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -36,6 +43,7 @@ export default function TitleChanger() {
|
||||
placeholder="/favicon.svg"
|
||||
{...form.getInputProps('favicon')}
|
||||
/>
|
||||
<TextInput label="Background" placeholder="" {...form.getInputProps('background')} />
|
||||
<Button type="submit" color={config.settings.primary_color || 'red'}>
|
||||
Save
|
||||
</Button>
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
SegmentedControl,
|
||||
TextInput,
|
||||
Anchor,
|
||||
ColorPicker,
|
||||
useMantineTheme,
|
||||
} from '@mantine/core';
|
||||
import { useState } from 'react';
|
||||
|
||||
@@ -28,6 +28,7 @@ export default function Aside(props: any) {
|
||||
className={cx(classes.hide)}
|
||||
style={{
|
||||
border: 'none',
|
||||
background: 'none',
|
||||
}}
|
||||
width={{
|
||||
base: 'auto',
|
||||
|
||||
19
src/components/layout/Background.tsx
Normal file
19
src/components/layout/Background.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Global } from '@mantine/core';
|
||||
import { useConfig } from '../../tools/state';
|
||||
|
||||
export function Background() {
|
||||
const { config } = useConfig();
|
||||
|
||||
return (
|
||||
<Global
|
||||
styles={{
|
||||
body: {
|
||||
backgroundImage: `url('${config.settings.background}')` || '',
|
||||
backgroundPosition: 'center',
|
||||
backgroundSize: 'cover',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export function Header(props: any) {
|
||||
|
||||
return (
|
||||
<Head height="auto">
|
||||
<Group m="xs" position="apart">
|
||||
<Group p="xs" position="apart">
|
||||
<Box className={classes.hide}>
|
||||
<Logo style={{ fontSize: 22 }} />
|
||||
</Box>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Header } from './Header';
|
||||
import { Footer } from './Footer';
|
||||
import Aside from './Aside';
|
||||
import { HeaderConfig } from './HeaderConfig';
|
||||
import { Background } from './Background';
|
||||
|
||||
const useStyles = createStyles((theme) => ({
|
||||
main: {},
|
||||
@@ -13,6 +14,7 @@ export default function Layout({ children, style }: any) {
|
||||
return (
|
||||
<AppShell aside={<Aside />} header={<Header />} footer={<Footer links={[]} />}>
|
||||
<HeaderConfig />
|
||||
<Background />
|
||||
<main
|
||||
className={cx(classes.main)}
|
||||
style={{
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface Settings {
|
||||
favicon?: string;
|
||||
primary_color?: string;
|
||||
secondary_color?: string;
|
||||
background?: string;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
|
||||
Reference in New Issue
Block a user