www/src/components/branding.tsx

52 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-09-17 01:45:08 -04:00
import Link from "next/link";
import Image from "next/image";
import { cva } from "class-variance-authority";
import { cn } from "@/lib/utils";
const brandingVariants = cva(
2024-09-18 23:32:07 -04:00
"relative group-hover:opacity-75 hover:opacity-75 select-none transition-all transform-gpu",
2024-09-17 01:45:08 -04:00
{
variants: {
size: {
2024-09-18 23:32:07 -04:00
xs: "w-10 h-10",
2024-09-17 01:45:08 -04:00
sm: "w-16 h-16",
default: "w-24 h-24",
lg: "w-32 h-32",
},
},
defaultVariants: {
size: "default",
},
}
);
/**
* The props for this component.
*/
type BrandingProps = {
2024-09-18 23:32:07 -04:00
/**
* The href to go to when clicked.
*/
href?: string;
2024-09-17 01:45:08 -04:00
/**
* The size of the branding.
*/
2024-09-18 23:32:07 -04:00
size?: "xs" | "sm" | "default" | "lg";
2024-09-17 01:45:08 -04:00
/**
* The optional class name to apply to the branding.
*/
className?: string;
};
2024-09-18 23:32:07 -04:00
const Branding = ({ href, size, className }: BrandingProps) => (
<Link
className={cn(brandingVariants({ size, className }))}
href={href ?? "/"}
>
2024-09-19 01:04:51 -04:00
<Image src="/media/logo.png" alt="PulseApp Logo" fill priority />
2024-09-17 01:45:08 -04:00
</Link>
);
export default Branding;