migration

This commit is contained in:
Théo LAGACHE
2025-05-16 15:54:17 +02:00
parent 01019fe1a3
commit 6f2523e524
285 changed files with 15492 additions and 46090 deletions
@@ -1,46 +1,40 @@
"use client"
import {useEffect, useState} from "react";
import {CheckIcon, ClipboardIcon, Copy} from "lucide-react";
import {Button, buttonVariants} from "@/components/ui/button";
import {cn} from "@/lib/utils";
import {useTranslations} from "use-intl";
"use client";
import { useEffect, useState } from "react";
import { CheckIcon, Copy } from "lucide-react";
import { Button } from "@/components/ui/button";
export async function copyToClipboardWithMeta(value: string) {
navigator.clipboard.writeText(value)
navigator.clipboard.writeText(value);
}
export type CopyButtonProps = {
value: string,
className: string
}
value: string;
className?: string;
};
export const CopyButton = (props: CopyButtonProps) => {
const { value } = props;
const {value} = props
const [hasCopied, setHasCopied] = useState(false)
const [hasCopied, setHasCopied] = useState(false);
useEffect(() => {
setTimeout(() => {
setHasCopied(false)
}, 2000)
}, [hasCopied])
setHasCopied(false);
}, 2000);
}, [hasCopied]);
return (
<Button
// className={cn(buttonVariants({size: "sm"}))}
onClick={() => {
copyToClipboardWithMeta(value)
setHasCopied(true)
copyToClipboardWithMeta(value);
setHasCopied(true);
}}
{...props}
>
<span className="mr-2">Copy</span>
{hasCopied ? <CheckIcon/> : <Copy size="18"/>}
{hasCopied ? <CheckIcon /> : <Copy size="18" />}
</Button>
)
}
);
};