Skip to content

Commit

Permalink
Add motion
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Jan 2, 2025
1 parent bdebd9e commit 86841f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"clsx": "^2.1.1",
"input-otp": "^1.4.1",
"lucide-react": "^0.469.0",
"motion": "^11.15.0",
"next": "15.1.3",
"next-international": "^1.3.1",
"react": "^19.0.0",
Expand Down
17 changes: 16 additions & 1 deletion apps/web/src/components/copy-install.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import { AnimatePresence, motion } from "motion/react";
import Link from "next/link";
import { useState } from "react";

Expand Down Expand Up @@ -68,11 +69,12 @@ export function CopyInstall() {

const copyCommand = () => {
navigator.clipboard.writeText("npx languine@latest");
setCopied(true);
setTimeout(() => setCopied(false), 1000);
};

return (
<div className="flex mt-4 border border-dashed border-muted-foreground p-2 px-4 text-sm w-full">
<div className="flex mt-4 border border-dashed border-muted-foreground p-2 px-4 text-sm w-full relative">
<button
type="button"
onClick={copyCommand}
Expand All @@ -90,6 +92,19 @@ export function CopyInstall() {
<GitHubIcon />
</Link>
</div>

<AnimatePresence>
{copied && (
<motion.div
initial={{ opacity: 0, y: 0 }}
animate={{ opacity: 1, y: -30 }}
exit={{ opacity: 0, y: -40 }}
className="absolute left-1/2 -translate-x-1/2 top-0 text-xs text-primary"
>
Copied to clipboard
</motion.div>
)}
</AnimatePresence>
</div>
);
}
Binary file modified bun.lockb
Binary file not shown.

0 comments on commit 86841f6

Please sign in to comment.