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

40 lines
1.0 KiB
TypeScript
Raw Normal View History

2022-05-15 12:42:53 +02:00
import { Group, Image, Text } from '@mantine/core';
2022-12-04 17:36:30 +01:00
import { useConfigContext } from '../../config/provider';
import { useColorTheme } from '../../tools/color';
2022-04-25 00:11:32 +02:00
2022-12-04 17:36:30 +01:00
interface LogoProps {
size?: 'md' | 'xs';
withoutText?: boolean;
}
export function Logo({ size = 'md', withoutText = false }: LogoProps) {
const { config } = useConfigContext();
const { primaryColor, secondaryColor } = useColorTheme();
2022-06-07 00:07:56 +00:00
2022-05-12 14:24:15 +02:00
return (
2022-12-04 17:36:30 +01:00
<Group spacing={size === 'md' ? 'xs' : 4} noWrap>
2022-05-15 12:42:53 +02:00
<Image
2022-12-04 17:36:30 +01:00
width={size === 'md' ? 50 : 20}
src={config?.settings.customization.logoImageUrl || '/imgs/logo/logo.png'}
2022-05-15 12:42:53 +02:00
style={{
position: 'relative',
}}
/>
{withoutText ? null : (
<Text
2022-12-04 17:36:30 +01:00
size={size === 'md' ? 22 : 'xs'}
weight="bold"
variant="gradient"
gradient={{
from: primaryColor,
to: secondaryColor,
deg: 145,
}}
2022-05-21 00:52:55 +02:00
>
2022-12-04 17:36:30 +01:00
{config?.settings.customization.pageTitle || 'Homarr'}
</Text>
)}
</Group>
2022-05-12 14:24:15 +02:00
);
2022-04-25 00:11:32 +02:00
}