Files
Homarr/src/components/layout/Layout.tsx

43 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-06-07 00:30:42 +02:00
import { AppShell, createStyles } from '@mantine/core';
2022-04-25 00:11:32 +02:00
import { Header } from './Header';
import { Footer } from './Footer';
2022-05-10 18:58:21 +02:00
import Aside from './Aside';
2022-06-12 08:04:20 +02:00
import Navbar from './Navbar';
import { HeaderConfig } from './HeaderConfig';
import { Background } from './Background';
2022-06-12 08:04:20 +02:00
import { useConfig } from '../../tools/state';
2022-04-25 00:11:32 +02:00
const useStyles = createStyles((theme) => ({
2022-05-16 13:54:29 +02:00
main: {},
2022-04-25 00:11:32 +02:00
}));
export default function Layout({ children, style }: any) {
const { classes, cx } = useStyles();
2022-06-12 08:04:20 +02:00
const { config } = useConfig();
const widgetPosition = config?.settings?.widgetPosition === 'left';
2022-04-25 00:11:32 +02:00
return (
2022-06-12 08:04:20 +02:00
<AppShell
fixed={false}
2022-06-12 08:04:20 +02:00
header={<Header />}
navbar={widgetPosition ? <Navbar /> : undefined}
aside={widgetPosition ? undefined : <Aside />}
2022-06-12 08:04:20 +02:00
footer={<Footer links={[]} />}
>
<HeaderConfig />
<Background />
2022-05-16 13:54:29 +02:00
<main
className={cx(classes.main)}
style={{
...style,
}}
>
{children}
</main>
<style>
{cx(config.settings.customCSS)}
</style>
2022-04-25 00:11:32 +02:00
</AppShell>
);
}