mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2025-05-18 15:26:36 +00:00
feat(components): add back button component with tooltip
This commit is contained in:
parent
247e54c40c
commit
97405a8657
36
src/components/back-button.tsx
Normal file
36
src/components/back-button.tsx
Normal file
@ -0,0 +1,36 @@
|
||||
import Link from "next/link";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ArrowLeftIcon } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
|
||||
interface BackButtonProps {
|
||||
href: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default function BackButton({
|
||||
href,
|
||||
className,
|
||||
...props
|
||||
}: BackButtonProps) {
|
||||
return (
|
||||
<TooltipProvider delayDuration={0}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
className={cn("h-8 w-auto p-2", className)}
|
||||
asChild
|
||||
{...props}
|
||||
>
|
||||
<Link href={href}>
|
||||
<ArrowLeftIcon size={16} aria-hidden="true" />
|
||||
</Link>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="px-2 py-1 text-xs">Back</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user