Skip to content

Commit 7ff0202

Browse files
committed
fix(sidebar): resolve nested button DOM nesting warning
1 parent a3df91e commit 7ff0202

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

dashboard/src/components/layout/sidebar.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -395,32 +395,34 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
395395
</TooltipProvider>
396396
</div>
397397
) : state !== 'collapsed' && !isMobile ? (
398-
<SidebarMenuButton size="lg" className={cn('relative !gap-2', isRTL ? 'pl-10' : 'pr-10')}>
399-
<a href={REPO_URL} target="_blank" className="flex items-center gap-2 flex-1 min-w-0">
400-
<img
401-
src={resolvedTheme === 'dark' ? window.location.pathname + 'statics/favicon/logo.png' : window.location.pathname + 'statics/favicon/logo-dark.png'}
402-
alt="PasarGuard Logo"
403-
className="h-8 w-8 flex-shrink-0 object-contain"
404-
/>
405-
<div className="flex flex-col overflow-hidden min-w-0 flex-1 items-start">
406-
<span className={cn(isRTL ? 'text-right' : 'text-left', 'truncate text-sm font-semibold leading-tight')}>{t('pasarguard')}</span>
407-
<div className="flex items-center gap-1.5 min-w-0">
408-
<span className="text-xs opacity-45 shrink-0">{version}</span>
409-
<div className="min-w-0 flex-1">
410-
<TooltipProvider>
411-
<VersionBadge currentVersion={currentVersion} />
412-
</TooltipProvider>
398+
<div className={cn('relative', isRTL ? 'pl-10' : 'pr-10')}>
399+
<SidebarMenuButton size="lg" className={cn('!gap-2 w-full')}>
400+
<a href={REPO_URL} target="_blank" className="flex items-center gap-2 flex-1 min-w-0">
401+
<img
402+
src={resolvedTheme === 'dark' ? window.location.pathname + 'statics/favicon/logo.png' : window.location.pathname + 'statics/favicon/logo-dark.png'}
403+
alt="PasarGuard Logo"
404+
className="h-8 w-8 flex-shrink-0 object-contain"
405+
/>
406+
<div className="flex flex-col overflow-hidden min-w-0 flex-1 items-start">
407+
<span className={cn(isRTL ? 'text-right' : 'text-left', 'truncate text-sm font-semibold leading-tight')}>{t('pasarguard')}</span>
408+
<div className="flex items-center gap-1.5 min-w-0">
409+
<span className="text-xs opacity-45 shrink-0">{version}</span>
410+
<div className="min-w-0 flex-1">
411+
<TooltipProvider>
412+
<VersionBadge currentVersion={currentVersion} />
413+
</TooltipProvider>
414+
</div>
413415
</div>
414416
</div>
415-
</div>
416-
</a>
417+
</a>
418+
</SidebarMenuButton>
417419
<TooltipProvider>
418420
<Tooltip>
419421
<TooltipTrigger asChild>
420422
<Button
421423
variant="ghost"
422424
size="icon"
423-
className={cn('absolute h-8 w-8 shrink-0 z-10', isRTL ? 'left-2' : 'right-2')}
425+
className={cn('absolute top-1/2 -translate-y-1/2 h-8 w-8 shrink-0 z-10', isRTL ? 'left-2' : 'right-2')}
424426
onClick={(e) => {
425427
e.preventDefault()
426428
e.stopPropagation()
@@ -436,7 +438,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
436438
</TooltipContent>
437439
</Tooltip>
438440
</TooltipProvider>
439-
</SidebarMenuButton>
441+
</div>
440442
) : (
441443
<SidebarMenuButton size="lg" asChild className="!gap-2">
442444
<a href={REPO_URL} target="_blank">

0 commit comments

Comments
 (0)