35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
import { cva } from 'class-variance-authority';
|
|
import { ClientLogo } from '~/components/ui/client-logo';
|
|
import { cn } from '~/lib/utils';
|
|
import type { BrandIdentity } from '~/types/project';
|
|
|
|
const tileVariants = cva('relative flex items-center justify-center overflow-hidden', {
|
|
variants: {
|
|
size: {
|
|
// Padding is the room around the logo, which fills the rest
|
|
card: 'h-[150px] w-full rounded-control p-6',
|
|
header: 'h-24 w-[200px] shrink-0 rounded-card px-6 py-4',
|
|
field: 'h-14 w-[120px] shrink-0 rounded-item p-2',
|
|
},
|
|
background: { light: 'bg-logo-tile-light', dark: 'bg-logo-tile-dark' },
|
|
},
|
|
});
|
|
|
|
interface LogoTileProps {
|
|
brand: BrandIdentity;
|
|
size: 'card' | 'header' | 'field';
|
|
className?: string;
|
|
children?: ReactNode;
|
|
}
|
|
|
|
// The client logo on a tile coloured by the project's logo background (admin screens)
|
|
export function LogoTile({ brand, size, className, children }: LogoTileProps) {
|
|
return (
|
|
<div className={cn(tileVariants({ size, background: brand.logoBg }), className)} style={brand.logoBgColor ? { backgroundColor: brand.logoBgColor } : undefined}>
|
|
<ClientLogo brand={brand} variant='plain' size='fill' />
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|