mirror of
https://github.com/cosscom/coss.git
synced 2026-09-14 20:06:50 +08:00
9302c06311
* update biome config + resolve issues * improve the ui:sync command to run organizeImports on packages * reformat * build registry * exclude base-ui stuff * fix useExportsLast * further improvements * silence errors * exclude examples app * update biome + reformat * format all the other files * include examples app * improve copyable-field * remove unwanted comment * remove a few unneeded biome comments * avoid nested ternary * refactored some shared components * upgrade base ui to 1.2.0 * fix
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { CheckIcon, TerminalIcon } from "lucide-react";
|
|
import {
|
|
Tooltip,
|
|
TooltipContent,
|
|
TooltipProvider,
|
|
TooltipTrigger,
|
|
} from "@/registry/default/ui/tooltip";
|
|
import { useCopy } from "@/hooks/use-copy";
|
|
|
|
const CopyLayout = ({ command }: { command: string | undefined }) => {
|
|
const { copied, copy } = useCopy();
|
|
|
|
return (
|
|
<TooltipProvider delayDuration={0}>
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<button
|
|
aria-label={copied ? "Copied" : "Copy command"}
|
|
className="inline-flex items-center gap-1 text-sm hover:underline max-sm:hidden"
|
|
disabled={copied}
|
|
onClick={() => copy(command || "")}
|
|
type="button"
|
|
>
|
|
{copied ? (
|
|
<CheckIcon className="size-4 text-emerald-600" />
|
|
) : (
|
|
<TerminalIcon className="size-4 text-muted-foreground" />
|
|
)}
|
|
CLI Command
|
|
</button>
|
|
</TooltipTrigger>
|
|
<TooltipContent className="px-2 py-1 text-muted-foreground text-xs">
|
|
Click to copy
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
</TooltipProvider>
|
|
);
|
|
};
|
|
|
|
export default CopyLayout;
|