Skip to content

Commit ee3bf0c

Browse files
authored
Merge pull request #374 from oasisprotocol/lw/sidebar-links
Sidebar links not buttons
2 parents c51dc60 + af3dcd3 commit ee3bf0c

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.changelog/374.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sidebar links not buttons

src/components/Layout/MainLayout.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { FC } from 'react'
22
import { Header } from './Header'
33
import { Footer } from './Footer'
4-
import { NavLink, Outlet, useLocation, useNavigate } from 'react-router-dom'
4+
import { NavLink, Outlet, useLocation } from 'react-router-dom'
55
import {
66
Sidebar,
77
SidebarContent,
@@ -58,7 +58,6 @@ const breadcrumbConfigs = [
5858
]
5959

6060
export const MainLayout: FC = () => {
61-
const navigate = useNavigate()
6261
const location = useLocation()
6362

6463
const getBreadcrumbConfig = () => {
@@ -113,47 +112,51 @@ export const MainLayout: FC = () => {
113112
<SidebarMenuItem>
114113
<SidebarMenuButton asChild>
115114
<Button
116-
onClick={() => navigate('/dashboard')}
117115
variant="ghost"
118116
className="w-full justify-start p-2 h-8 rounded-md cursor-pointer"
117+
asChild
119118
>
120-
<LayoutDashboard className="h-4 w-4 text-sidebar-foreground" />
121-
Dashboard
119+
<NavLink to="/dashboard">
120+
<LayoutDashboard className="h-4 w-4 text-sidebar-foreground" />
121+
Dashboard
122+
</NavLink>
122123
</Button>
123124
</SidebarMenuButton>
124125
</SidebarMenuItem>
125126
<SidebarMenuSub>
126127
<SidebarMenuSubItem>
127128
<SidebarMenuSubButton asChild>
128129
<Button
129-
onClick={() => navigate('/dashboard/apps')}
130130
variant="ghost"
131131
className="w-full justify-start p-2 h-8 rounded-md cursor-pointer"
132+
asChild
132133
>
133-
Apps
134+
<NavLink to="/dashboard/apps">Apps</NavLink>
134135
</Button>
135136
</SidebarMenuSubButton>
136137
</SidebarMenuSubItem>
137138
<SidebarMenuSubItem>
138139
<SidebarMenuSubButton asChild>
139140
<Button
140-
onClick={() => navigate('/dashboard/machines')}
141141
variant="ghost"
142142
className="w-full justify-start p-2 h-8 rounded-md cursor-pointer"
143+
asChild
143144
>
144-
Machines
145+
<NavLink to="/dashboard/machines">Machines</NavLink>
145146
</Button>
146147
</SidebarMenuSubButton>
147148
</SidebarMenuSubItem>
148149
</SidebarMenuSub>
149150
<SidebarMenuButton asChild>
150151
<Button
151-
onClick={() => navigate('/explore')}
152152
variant="ghost"
153153
className="w-full justify-start p-2 h-8 rounded-md cursor-pointer"
154+
asChild
154155
>
155-
<Compass className="h-4 w-4 text-sidebar-foreground" />
156-
Explore
156+
<NavLink to="/explore">
157+
<Compass className="h-4 w-4 text-sidebar-foreground" />
158+
Explore
159+
</NavLink>
157160
</Button>
158161
</SidebarMenuButton>
159162
</SidebarMenu>

0 commit comments

Comments
 (0)