mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-22 13:36:16 +01:00
* feat: Added tooltips for navbar buttons to clear meaning of each one. * update tooltips and fix linter errors --------- Co-authored-by: henrygd <hank@henrygd.me>
37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
import { Trans } from "@lingui/react/macro"
|
|
import { CopyIcon } from "lucide-react"
|
|
import { copyToClipboard } from "@/lib/utils"
|
|
import { Button } from "./button"
|
|
import { Input } from "./input"
|
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip"
|
|
|
|
export function InputCopy({ value, id, name }: { value: string; id: string; name: string }) {
|
|
return (
|
|
<div className="relative">
|
|
<Input readOnly id={id} name={name} value={value} required></Input>
|
|
<div
|
|
className={
|
|
"h-6 w-24 bg-linear-to-r rtl:bg-linear-to-l from-transparent to-background to-65% absolute top-2 end-1 pointer-events-none"
|
|
}
|
|
></div>
|
|
<Tooltip disableHoverableContent={true}>
|
|
<TooltipTrigger asChild>
|
|
<Button
|
|
type="button"
|
|
variant={"link"}
|
|
className="absolute end-0 top-0"
|
|
onClick={() => copyToClipboard(value)}
|
|
>
|
|
<CopyIcon className="size-4" />
|
|
</Button>
|
|
</TooltipTrigger>
|
|
<TooltipContent>
|
|
<p>
|
|
<Trans>Click to copy</Trans>
|
|
</p>
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
</div>
|
|
)
|
|
}
|