Skip to content

Commit ef82663

Browse files
yz778mrdjohnson
authored andcommitted
feat: add Toogle Sidebar tooltip
1 parent 668bc28 commit ef82663

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

src/components/Navbar.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,20 @@ const Navbar = () => {
2323
return (
2424
<div className="navbar mb-2 flex h-auto min-h-0 flex-row justify-between gap-3 bg-base-300 p-1 md:mb-0 md:flex-col md:p-0">
2525
<div className="ml-2 hidden items-center pr-2 md:flex md:text-xl">
26-
<button
27-
className="absolute left-2 text-base-content/30 transition-colors duration-100 ease-in-out hover:text-base-content/80"
28-
onClick={() => settingStore.toggleSideBar()}
26+
<KeyboardTooltip
27+
command="$mod+M"
28+
placement="bottom"
29+
showArrow={false}
30+
className="-mt-2"
31+
title="Toggle Sidebar"
2932
>
30-
<ShrinkHorizontal />
31-
</button>
33+
<button
34+
className="absolute left-2 text-base-content/30 transition-colors duration-100 ease-in-out hover:text-base-content/80"
35+
onClick={() => settingStore.toggleSideBar()}
36+
>
37+
<ShrinkHorizontal />
38+
</button>
39+
</KeyboardTooltip>
3240

3341
<FunTitle className="md:text-xl" />
3442
</div>

src/containers/SideBar.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { settingStore } from '~/core/setting/SettingStore'
1111
import MediaEject from '~/icons/MediaEject'
1212
import { Divider } from '@heroui/react'
1313

14+
import KeyboardTooltip from '~/components/KeyboardToolTip'
15+
1416
export type AccordionSectionProps = {
1517
isOpen: boolean
1618
onSectionClicked: () => void
@@ -69,15 +71,23 @@ export const SideBar = () => {
6971
</div>
7072

7173
{/* hide sidebar button */}
72-
<button
73-
className={twMerge(
74-
'group absolute -right-8 top-[45%] z-20 opacity-30 transition-all duration-300 ease-in-out hover:opacity-100 group-hover/sidebar:opacity-100',
75-
isSidebarOpen && '-right-4',
76-
)}
77-
onClick={() => settingStore.toggleSideBar()}
74+
<KeyboardTooltip
75+
command="$mod+M"
76+
placement="bottom"
77+
showArrow={false}
78+
className="-mt-2"
79+
title="Toggle Sidebar"
7880
>
79-
<MediaEject className={twMerge('h-8 w-8 rotate-90', isSidebarOpen && '-rotate-90')} />
80-
</button>
81+
<button
82+
className={twMerge(
83+
'group absolute -right-8 top-[45%] z-20 opacity-30 transition-all duration-300 ease-in-out hover:opacity-100 group-hover/sidebar:opacity-100',
84+
isSidebarOpen && '-right-4',
85+
)}
86+
onClick={() => settingStore.toggleSideBar()}
87+
>
88+
<MediaEject className={twMerge('h-8 w-8 rotate-90', isSidebarOpen && '-rotate-90')} />
89+
</button>
90+
</KeyboardTooltip>
8191
</nav>
8292
)
8393
}

0 commit comments

Comments
 (0)