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

36 lines
964 B
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';
2022-12-04 18:45:14 +01:00
import { usePrimaryGradient } from './useGradient';
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();
2022-12-04 18:45:14 +01:00
const primaryGradient = usePrimaryGradient();
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"
2022-12-04 18:45:14 +01:00
gradient={primaryGradient}
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
}