Files
Homarr/src/components/modules/moduleWrapper.tsx

21 lines
647 B
TypeScript
Raw Normal View History

import { Card, useMantineTheme } from '@mantine/core';
import { useConfig } from '../../tools/state';
2022-05-10 18:57:04 +02:00
import { IModule } from './modules';
export default function ModuleWrapper(props: any) {
const { module }: { module: IModule } = props;
const { config } = useConfig();
const enabledModules = config.settings.enabledModules ?? [];
// Remove 'Module' from enabled modules titles
const isShown = enabledModules.includes(module.title);
2022-05-10 18:57:04 +02:00
const theme = useMantineTheme();
if (!isShown) {
return null;
}
2022-05-10 18:57:04 +02:00
return (
2022-05-16 15:55:22 +02:00
<Card hidden={!isShown} mx="sm" withBorder radius="lg" shadow="sm">
<module.component />
2022-05-10 18:57:04 +02:00
</Card>
);
}