"use client";
import { useRouter } from "next/navigation";
import { animatePageOut } from "@/animations";
export default function TransitionLink({
href,
label,
}: {
href: string;
label: string;
}) {
const router = useRouter();
const handleClick = () => {
animatePageOut(href, router);
};
return (
<button
className="border-[1px] border-black p-4 rounded-xl hover:bg-black hover:text-neutral-100 cursor-pointer"
onClick={handleClick}
>
{label}
</button>
);
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter