Skip to content

An AI-powered search engine with a generative UI

Add tooltip to minimize button

Yoshiki Miura93f6e4456e39
diff --git a/components/artifact/artifact-panel.tsx b/components/artifact/artifact-panel.tsx
index b66cfae8..4fd4bdde 100644
--- a/components/artifact/artifact-panel.tsx
+++ b/components/artifact/artifact-panel.tsx
@@ -2,6 +2,12 @@
import { Button } from '@/components/ui/button'
import { Separator } from '@/components/ui/separator'
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger
+} from '@/components/ui/tooltip'
import { Minimize2, Wrench } from 'lucide-react'
import { ArtifactContent } from './artifact-content'
import { useArtifact } from './artifact-context'
@@ -12,31 +18,40 @@ export function ArtifactPanel() {
if (!artifact) return null
return (
- <div className="h-full flex flex-col overflow-hidden bg-muted md:px-4 md:py-14">
- <div className="flex flex-col h-full bg-background rounded-xl md:border overflow-hidden">
- <div className="flex items-center justify-between px-4 py-2">
- <h3 className="flex items-center gap-2">
- <div className="bg-muted p-2 rounded-md flex items-center gap-2">
- <Wrench size={18} />
- </div>
- <span className="text-sm font-medium capitalize">
- {artifact.toolName}
- </span>
- </h3>
- <Button
- variant="ghost"
- size="icon"
- onClick={close}
- aria-label="Close panel"
- >
- <Minimize2 className="h-4 w-4" />
- </Button>
- </div>
- <Separator className="my-1 bg-border/50" />
- <div data-vaul-no-drag className="flex-1 overflow-y-auto p-4">
- <ArtifactContent artifact={artifact} />
+ <TooltipProvider>
+ <div className="h-full flex flex-col overflow-hidden bg-muted md:px-4 md:py-14">
+ <div className="flex flex-col h-full bg-background rounded-xl md:border overflow-hidden">
+ <div className="flex items-center justify-between px-4 py-2">
+ <h3 className="flex items-center gap-2">
+ <div className="bg-muted p-2 rounded-md flex items-center gap-2">
+ <Wrench size={18} />
+ </div>
+ <span className="text-sm font-medium capitalize">
+ {artifact.toolName}
+ </span>
+ </h3>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={close}
+ aria-label="Close panel"
+ >
+ <Minimize2 className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Minimize</p>
+ </TooltipContent>
+ </Tooltip>
+ </div>
+ <Separator className="my-1 bg-border/50" />
+ <div data-vaul-no-drag className="flex-1 overflow-y-auto p-4">
+ <ArtifactContent artifact={artifact} />
+ </div>
</div>
</div>
- </div>
+ </TooltipProvider>
)
}