An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
feat: add hover icon transition to SidebarTrigger
Yoshiki Miura7af032e374aa
diff --git a/components/artifact/chat-artifact-container.tsx b/components/artifact/chat-artifact-container.tsxindex 93f52389..5d9aabfb 100644--- a/components/artifact/chat-artifact-container.tsx+++ b/components/artifact/chat-artifact-container.tsx@@ -77,7 +77,7 @@ export function ChatArtifactContainer({<div className="flex-1 min-h-0 h-screen flex"><div className="absolute p-4 z-50 transition-opacity duration-1000">{(!open || isMobileSidebar) && (- <SidebarTrigger className="animate-fade-in" />+ <SidebarTrigger className="animate-fade-in" showIconLogo />)}</div>diff --git a/components/ui/sidebar.tsx b/components/ui/sidebar.tsxindex aa01bab1..f8bc21b4 100644--- a/components/ui/sidebar.tsx+++ b/components/ui/sidebar.tsx@@ -11,6 +11,7 @@ import { cn } from '@/lib/utils/index'import { useIsMobile } from '@/hooks/use-mobile'import { Button } from '@/components/ui/button'+import { IconLogo } from '@/components/ui/icons'import { Input } from '@/components/ui/input'import { Separator } from '@/components/ui/separator'import {@@ -301,8 +302,10 @@ Sidebar.displayName = 'Sidebar'const SidebarTrigger = React.forwardRef<React.ElementRef<typeof Button>,- React.ComponentProps<typeof Button>->(({ className, onClick, ...props }, ref) => {+ React.ComponentProps<typeof Button> & {+ showIconLogo?: boolean+ }+>(({ className, onClick, showIconLogo = false, ...props }, ref) => {const { toggleSidebar } = useSidebar()return (@@ -311,14 +314,21 @@ const SidebarTrigger = React.forwardRef<data-sidebar="trigger"variant="ghost"size="icon"- className={cn('size-6', className)}+ className={cn('size-6 group', className)}onClick={event => {onClick?.(event)toggleSidebar()}}{...props}>- <PanelLeft size={18} />+ {showIconLogo ? (+ <>+ <IconLogo className="size-5 group-hover:hidden" />+ <PanelLeft className="size-5 hidden group-hover:block" />+ </>+ ) : (+ <PanelLeft size={18} />+ )}<span className="sr-only">Toggle Sidebar</span></Button>)