Vendor 50 Aceternity UI components into components/ui from the official registry (ui.aceternity.com/registry/<slug>.json), adapted for this template's stack: Tailwind v4, motion/react 13, cn util, React 19. Add a live showcase gallery (/ui + /docs/... navigation is unchanged): app/ui/page.tsx renders <ShowcaseGallery> with 30+ demos — 3d-pin, aurora, background-beams, bento, card-stack, card-spotlight, direction-aware-hover, encrypted-text, evervault-card, flip-words, hero-highlight, hero-parallax, infinite-moving-cards, moving-border, sparkles, tracing-beam, animated-tooltip, typewriter-effect, placeholders-and-vanish-input and friends. Toolchain stays zero-warning: vendored animation code is scoped in eslint.config.mjs (react-hooks/react-compiler advisory rules, no-any, prefer-const, no-img-element) so app code keeps a 0-error gate. typecheck, build, 7 vitest tests and 2 test suites all green.
155 lines
5.3 KiB
TypeScript
155 lines
5.3 KiB
TypeScript
"use client";
|
|
import React, { useState } from "react";
|
|
import { motion } from "motion/react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export const PinContainer = ({
|
|
children,
|
|
title,
|
|
href,
|
|
className,
|
|
containerClassName,
|
|
}: {
|
|
children: React.ReactNode;
|
|
title?: string;
|
|
href?: string;
|
|
className?: string;
|
|
containerClassName?: string;
|
|
}) => {
|
|
const [transform, setTransform] = useState("translate(-50%,-50%) rotateX(0deg)");
|
|
|
|
const onMouseEnter = () => {
|
|
setTransform("translate(-50%,-50%) rotateX(40deg) scale(0.8)");
|
|
};
|
|
const onMouseLeave = () => {
|
|
setTransform("translate(-50%,-50%) rotateX(0deg) scale(1)");
|
|
};
|
|
|
|
return (
|
|
<a
|
|
className={cn("group/pin relative z-50 cursor-pointer", containerClassName)}
|
|
onMouseEnter={onMouseEnter}
|
|
onMouseLeave={onMouseLeave}
|
|
href={href || "/"}
|
|
>
|
|
<div
|
|
style={{
|
|
perspective: "1000px",
|
|
transform: "rotateX(70deg) translateZ(0deg)",
|
|
}}
|
|
className="absolute top-1/2 left-1/2 mt-4 ml-[0.09375rem] -translate-x-1/2 -translate-y-1/2"
|
|
>
|
|
<div
|
|
style={{
|
|
transform: transform,
|
|
}}
|
|
className="absolute top-1/2 left-1/2 flex items-start justify-start overflow-hidden rounded-2xl border border-white/[0.1] bg-black p-4 shadow-[0_8px_16px_rgb(0_0_0/0.4)] transition duration-700 group-hover/pin:border-white/[0.2]"
|
|
>
|
|
<div className={cn("relative z-50", className)}>{children}</div>
|
|
</div>
|
|
</div>
|
|
<PinPerspective title={title} href={href} />
|
|
</a>
|
|
);
|
|
};
|
|
|
|
export const PinPerspective = ({ title, href }: { title?: string; href?: string }) => {
|
|
return (
|
|
<motion.div className="pointer-events-none z-[60] flex h-80 w-96 items-center justify-center opacity-0 transition duration-500 group-hover/pin:opacity-100">
|
|
<div className="inset-0 -mt-7 h-full w-full flex-none">
|
|
<div className="absolute inset-x-0 top-0 flex justify-center">
|
|
<a
|
|
href={href}
|
|
target={"_blank"}
|
|
className="relative z-10 flex items-center space-x-2 rounded-full bg-zinc-950 px-4 py-0.5 ring-1 ring-white/10"
|
|
>
|
|
<span className="relative z-20 inline-block py-0.5 text-xs font-bold text-white">
|
|
{title}
|
|
</span>
|
|
|
|
<span className="absolute -bottom-0 left-[1.125rem] h-px w-[calc(100%-2.25rem)] bg-gradient-to-r from-emerald-400/0 via-emerald-400/90 to-emerald-400/0 transition-opacity duration-500 group-hover/btn:opacity-40"></span>
|
|
</a>
|
|
</div>
|
|
|
|
<div
|
|
style={{
|
|
perspective: "1000px",
|
|
transform: "rotateX(70deg) translateZ(0)",
|
|
}}
|
|
className="absolute top-1/2 left-1/2 mt-4 ml-[0.09375rem] -translate-x-1/2 -translate-y-1/2"
|
|
>
|
|
<>
|
|
<motion.div
|
|
initial={{
|
|
opacity: 0,
|
|
scale: 0,
|
|
x: "-50%",
|
|
y: "-50%",
|
|
}}
|
|
animate={{
|
|
opacity: [0, 1, 0.5, 0],
|
|
scale: 1,
|
|
|
|
z: 0,
|
|
}}
|
|
transition={{
|
|
duration: 6,
|
|
repeat: Infinity,
|
|
delay: 0,
|
|
}}
|
|
className="absolute top-1/2 left-1/2 h-[11.25rem] w-[11.25rem] rounded-[50%] bg-sky-500/[0.08] shadow-[0_8px_16px_rgb(0_0_0/0.4)]"
|
|
></motion.div>
|
|
<motion.div
|
|
initial={{
|
|
opacity: 0,
|
|
scale: 0,
|
|
x: "-50%",
|
|
y: "-50%",
|
|
}}
|
|
animate={{
|
|
opacity: [0, 1, 0.5, 0],
|
|
scale: 1,
|
|
|
|
z: 0,
|
|
}}
|
|
transition={{
|
|
duration: 6,
|
|
repeat: Infinity,
|
|
delay: 2,
|
|
}}
|
|
className="absolute top-1/2 left-1/2 h-[11.25rem] w-[11.25rem] rounded-[50%] bg-sky-500/[0.08] shadow-[0_8px_16px_rgb(0_0_0/0.4)]"
|
|
></motion.div>
|
|
<motion.div
|
|
initial={{
|
|
opacity: 0,
|
|
scale: 0,
|
|
x: "-50%",
|
|
y: "-50%",
|
|
}}
|
|
animate={{
|
|
opacity: [0, 1, 0.5, 0],
|
|
scale: 1,
|
|
|
|
z: 0,
|
|
}}
|
|
transition={{
|
|
duration: 6,
|
|
repeat: Infinity,
|
|
delay: 4,
|
|
}}
|
|
className="absolute top-1/2 left-1/2 h-[11.25rem] w-[11.25rem] rounded-[50%] bg-sky-500/[0.08] shadow-[0_8px_16px_rgb(0_0_0/0.4)]"
|
|
></motion.div>
|
|
</>
|
|
</div>
|
|
|
|
<>
|
|
<motion.div className="absolute right-1/2 bottom-1/2 h-20 w-px translate-y-[14px] bg-gradient-to-b from-transparent to-cyan-500 blur-[2px] group-hover/pin:h-40" />
|
|
<motion.div className="absolute right-1/2 bottom-1/2 h-20 w-px translate-y-[14px] bg-gradient-to-b from-transparent to-cyan-500 group-hover/pin:h-40" />
|
|
<motion.div className="absolute right-1/2 bottom-1/2 z-40 h-[4px] w-[4px] translate-x-[1.5px] translate-y-[14px] rounded-full bg-cyan-600 blur-[3px]" />
|
|
<motion.div className="absolute right-1/2 bottom-1/2 z-40 h-[2px] w-[2px] translate-x-[0.5px] translate-y-[14px] rounded-full bg-cyan-300" />
|
|
</>
|
|
</div>
|
|
</motion.div>
|
|
);
|
|
};
|