show a Home icon and label on hover over the sidebar brand row (#12277)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-11-06 15:50:42 +01:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 9ce2c6b131
commit f549a022ae
2 changed files with 33 additions and 6 deletions
@@ -17,6 +17,10 @@
href: string
icon?: any | undefined
iconProps?: Record<string, unknown>
// Shown in place of the icon and label while the row is hovered or focused, for a row
// whose resting look (a brand mark) does not say what it does.
hoverIcon?: any | undefined
hoverLabel?: string | undefined
isCollapsed: boolean
disabled?: boolean
lightMode?: boolean
@@ -33,6 +37,8 @@
href,
icon = undefined,
iconProps = {},
hoverIcon = undefined,
hoverLabel = undefined,
isCollapsed,
disabled = false,
lightMode = false,
@@ -50,6 +56,15 @@
isSelected = $page.url.pathname.startsWith(href)
}
})
let iconClass = $derived(
twMerge(
'flex-shrink-0 transition-all',
isSelected ? sidebarClasses.selectedText : sidebarClasses.iconText
)
)
const restingClass = 'group-hover:hidden group-focus-visible:hidden'
const hoverClass = 'hidden group-hover:block group-focus-visible:block'
</script>
{#if !disabled}
@@ -96,20 +111,29 @@
<SvelteComponent
{...iconProps}
size={16}
class={twMerge(
'flex-shrink-0 transition-all',
isSelected ? sidebarClasses.selectedText : sidebarClasses.iconText
)}
class={twMerge(iconClass, hoverIcon ? restingClass : '')}
/>
{/if}
{#if hoverIcon}
{@const HoverComponent = hoverIcon}
<HoverComponent size={16} class={twMerge(iconClass, hoverClass)} />
{/if}
{#if !isCollapsed}
<span
data-light-mode={lightMode}
class={twMerge('whitespace-pre truncate transition-all duration-75')}
class={twMerge(
'whitespace-pre truncate transition-all duration-75',
hoverLabel ? restingClass : ''
)}
>
{label}
</span>
{#if hoverLabel}
<span data-light-mode={lightMode} class={twMerge('whitespace-pre truncate', hoverClass)}>
{hoverLabel}
</span>
{/if}
{/if}
</a>
{#snippet text()}
@@ -91,7 +91,8 @@
Search,
ArrowLeft,
Star,
MessagesSquare
MessagesSquare,
House
} from 'lucide-svelte'
import { homeRowLearned, sidebarPrefs } from '$lib/components/sidebar/sidebarPrefs.svelte'
import { Button } from '$lib/components/common'
@@ -1425,6 +1426,8 @@ outside this layout, and their shortcut must reopen the URL that is their creden
}}
icon={WindmillIcon}
iconProps={{ white: darkMode, width: '16px', height: '16px' }}
hoverIcon={House}
hoverLabel="Home"
isCollapsed={collapsed}
aiId="sidebar-menu-link-home"
aiDescription="Button to navigate to home which contains all the user's scripts, flows and apps"