1import { PencilIcon } from "lucide-react";
2import type { ComponentProps } from "react";
3
4import { cn } from "../../lib/utils";
5import { Button } from "../ui/button";
6
7/** Edit affordances stay visible on touch devices and reveal on hover or focus. */
8export function PullRequestEditButton({
9 className,
10 ...props
11}: Omit<ComponentProps<typeof Button>, "children" | "render" | "size" | "variant"> & {
12 "aria-label": string;
13}) {
14 return (
15 <span
16 className={cn(
17 "flex shrink-0 opacity-0 transition-opacity pointer-coarse:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 focus-within:opacity-100 motion-reduce:transition-none",
18 className,
19 )}
20 >
21 <Button {...props} size="icon-xs" variant="ghost-muted">
22 <PencilIcon aria-hidden className="size-3" />
23 </Button>
24 </span>
25 );
26}