2026-08-13 03:29:33 +07:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { useRef } from "react";
|
2026-08-13 01:58:09 +07:00
|
|
|
import { cn } from "@/lib/cn";
|
2026-08-13 03:29:33 +07:00
|
|
|
import { gsap, motionDuration, motionEase, prefersReducedMotion, useGSAP } from "@/lib/motion";
|
2026-08-13 01:58:09 +07:00
|
|
|
|
|
|
|
|
type BrandMarkProps = {
|
|
|
|
|
className?: string;
|
2026-08-13 03:29:33 +07:00
|
|
|
/**
|
|
|
|
|
* Renders the mark for placement on a filled `primary` panel: the block reads
|
|
|
|
|
* in the panel's foreground colour instead of the brand green.
|
|
|
|
|
*/
|
2026-08-13 01:58:09 +07:00
|
|
|
inverted?: boolean;
|
|
|
|
|
};
|
|
|
|
|
|
2026-08-13 03:29:33 +07:00
|
|
|
/**
|
|
|
|
|
* An isometric block on a 24-unit grid — three faces, no interior detail.
|
|
|
|
|
*
|
|
|
|
|
* The mark ships as small as 32px, so it is drawn with only the silhouette and
|
|
|
|
|
* the three face tones that separate it. Colour comes from `currentColor` plus
|
|
|
|
|
* two `color-mix` shades of it, so the block follows `text-primary` /
|
|
|
|
|
* `text-primary-foreground` and works on the sidebar, the light dashboard, and
|
|
|
|
|
* the filled primary panel from a single asset.
|
|
|
|
|
*/
|
|
|
|
|
function BrandGlyph({ className }: { className?: string }) {
|
|
|
|
|
return (
|
|
|
|
|
<svg viewBox="0 0 24 24" className={className} aria-hidden="true">
|
|
|
|
|
{/* Left face — mixed toward black for the shadowed side. */}
|
|
|
|
|
<path
|
|
|
|
|
d="M2.5 7 12 12.2 12 22.4 2.5 17.2Z"
|
|
|
|
|
fill="color-mix(in oklch, currentColor 62%, black)"
|
|
|
|
|
/>
|
|
|
|
|
{/* Right face — the mid tone. */}
|
|
|
|
|
<path
|
|
|
|
|
d="M21.5 7 12 12.2 12 22.4 21.5 17.2Z"
|
|
|
|
|
fill="color-mix(in oklch, currentColor 80%, black)"
|
|
|
|
|
/>
|
|
|
|
|
{/* Top face — full strength, so the mark keys off `currentColor` exactly. */}
|
|
|
|
|
<path d="M12 1.6 21.5 7 12 12.2 2.5 7Z" fill="currentColor" />
|
|
|
|
|
</svg>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function BrandMark({ className, inverted }: BrandMarkProps) {
|
|
|
|
|
const ref = useRef<HTMLDivElement>(null);
|
|
|
|
|
|
|
|
|
|
useGSAP(
|
|
|
|
|
() => {
|
|
|
|
|
const el = ref.current;
|
|
|
|
|
if (!el || prefersReducedMotion()) return;
|
|
|
|
|
|
|
|
|
|
const enter = () =>
|
|
|
|
|
gsap.to(el, { y: -2, duration: motionDuration.fast, ease: motionEase.out });
|
|
|
|
|
const leave = () =>
|
|
|
|
|
gsap.to(el, { y: 0, duration: motionDuration.fast, ease: motionEase.out });
|
|
|
|
|
|
|
|
|
|
el.addEventListener("pointerenter", enter);
|
|
|
|
|
el.addEventListener("pointerleave", leave);
|
|
|
|
|
return () => {
|
|
|
|
|
el.removeEventListener("pointerenter", enter);
|
|
|
|
|
el.removeEventListener("pointerleave", leave);
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
{ scope: ref }
|
|
|
|
|
);
|
|
|
|
|
|
2026-08-13 01:58:09 +07:00
|
|
|
return (
|
|
|
|
|
<div
|
2026-08-13 03:29:33 +07:00
|
|
|
ref={ref}
|
2026-08-13 01:58:09 +07:00
|
|
|
className={cn(
|
2026-08-13 03:29:33 +07:00
|
|
|
"relative grid size-11 shrink-0 place-items-center will-change-transform",
|
|
|
|
|
inverted ? "text-primary-foreground" : "text-primary",
|
2026-08-13 01:58:09 +07:00
|
|
|
className
|
|
|
|
|
)}
|
2026-08-13 03:29:33 +07:00
|
|
|
aria-hidden="true"
|
2026-08-13 01:58:09 +07:00
|
|
|
>
|
2026-08-13 03:29:33 +07:00
|
|
|
<BrandGlyph className="size-full" />
|
2026-08-13 01:58:09 +07:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type BrandLockupProps = BrandMarkProps & {
|
|
|
|
|
subtitle: string;
|
|
|
|
|
compact?: boolean;
|
|
|
|
|
textClassName?: string;
|
|
|
|
|
};
|
|
|
|
|
|
2026-08-13 03:29:33 +07:00
|
|
|
export function BrandLockup({
|
|
|
|
|
subtitle,
|
|
|
|
|
compact,
|
|
|
|
|
className,
|
|
|
|
|
textClassName,
|
|
|
|
|
inverted,
|
|
|
|
|
}: BrandLockupProps) {
|
2026-08-13 01:58:09 +07:00
|
|
|
return (
|
|
|
|
|
<div className={cn("flex items-center gap-3", className)}>
|
2026-08-13 03:29:33 +07:00
|
|
|
<BrandMark className={compact ? "size-9" : undefined} inverted={inverted} />
|
2026-08-13 01:58:09 +07:00
|
|
|
<div className={textClassName}>
|
2026-08-13 03:29:33 +07:00
|
|
|
<p
|
|
|
|
|
className={cn(
|
|
|
|
|
"font-black uppercase tracking-[0.14em]",
|
|
|
|
|
compact ? "text-base" : "text-lg"
|
|
|
|
|
)}
|
|
|
|
|
>
|
2026-08-13 01:58:09 +07:00
|
|
|
Minikura
|
|
|
|
|
</p>
|
2026-08-13 03:29:33 +07:00
|
|
|
<p className="font-mono text-[9px] uppercase tracking-[0.2em] text-current/45">
|
|
|
|
|
{subtitle}
|
|
|
|
|
</p>
|
2026-08-13 01:58:09 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|