"use client";
import { Button } from "@/registry/default/ui/button";
import { Moon } from "@aliimam/icons";
import { cn } from "@/registry/default/lib/utils";
import { motion } from "motion/react";
export default function ButtonDemo() {
return (
<div className="flex gap-3">
<Button size={"icon-lg"} variant={"outline"} className="relative">
<div
className={cn(
"-inset-px pointer-events-none absolute rounded-[inherit] border-2 border-transparent border-inset [mask-clip:padding-box,border-box]",
"[mask-composite:intersect] [mask-image:linear-gradient(transparent,transparent),linear-gradient(#000,#000)]"
)}
>
<motion.div
className={cn(
"absolute aspect-square bg-gradient-to-r from-transparent via-primary to-primary"
)}
animate={{
offsetDistance: ["0%", "100%"],
}}
style={{
width: 20,
offsetPath: `rect(0 auto auto 0 round ${20}px)`,
}}
transition={{
repeat: Number.POSITIVE_INFINITY,
duration: 5,
ease: "linear",
}}
/>
</div>
<Moon />
</Button>
<Button size={"lg"} variant={"outline"} className="relative">
<div
className={cn(
"-inset-px pointer-events-none absolute rounded-[inherit] border-2 border-transparent border-inset [mask-clip:padding-box,border-box]",
"[mask-composite:intersect] [mask-image:linear-gradient(transparent,transparent),linear-gradient(#000,#000)]"
)}
>
<motion.div
className={cn(
"absolute aspect-square bg-gradient-to-r from-transparent via-primary to-primary"
)}
animate={{
offsetDistance: ["0%", "100%"],
}}
style={{
width: 20,
offsetPath: `rect(0 auto auto 0 round ${20}px)`,
}}
transition={{
repeat: Number.POSITIVE_INFINITY,
duration: 5,
ease: "linear",
}}
/>
</div>
Animated Border
</Button>
</div>
);
}