Files
Hayden Bleasel cf9ccd0076 Open Source Docs (#272)
* Scaffold Geistdocs instance

* Update biome.json

* Replace content

* Re-path docs

* Update docs package name

* Misc fixes

* Update geistdocs.tsx

* Move content to correct folder

* Start migrating custom components

* Finish migrating custom components

* Migrate existing redirects

* Remove #next suffixes from code blocks

* Migrate homepage and flags

* Remove duplicate lockfiles

* Start fixing homepage

* Replace Geist components

* Fix colors

* Improve layout

* Fix code blocks

* Fix hero

* Fix illustrations

* Fix redirect

* Fix nav links

* Patch in FrameworkSwitcher

* Bump Next.js in docs

* Delete turbo.json

* Misc fixes

* More logo fixes
2026-02-13 09:06:03 +02:00

59 lines
1.4 KiB
TypeScript

"use client";
import { track } from "@vercel/analytics";
import { CheckIcon, CopyIcon } from "lucide-react";
import { useState } from "react";
import { toast } from "sonner";
import {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupInput,
InputGroupText,
} from "@/components/ui/input-group";
const COPY_TIMEOUT = 2000;
type InstallerProps = {
command: string;
className?: string;
};
export const Installer = ({ command, className = "w-48" }: InstallerProps) => {
const [copied, setCopied] = useState(false);
const handleCopy = () => {
navigator.clipboard.writeText(command);
toast.success("Copied to clipboard");
setCopied(true);
track("Copied installer command");
setTimeout(() => {
setCopied(false);
}, COPY_TIMEOUT);
};
const Icon = copied ? CheckIcon : CopyIcon;
return (
<InputGroup className="h-10 bg-background font-mono shadow-none">
<InputGroupAddon>
<InputGroupText className="font-normal text-muted-foreground">
$
</InputGroupText>
</InputGroupAddon>
<InputGroupInput className={className} readOnly value={command} />
<InputGroupAddon align="inline-end">
<InputGroupButton
aria-label="Copy"
onClick={handleCopy}
size="icon-xs"
title="Copy"
>
<Icon className="size-3.5" size={14} />
</InputGroupButton>
</InputGroupAddon>
</InputGroup>
);
};