Skip to content

Commit

Permalink
use react-router-dom Link components instead of material UIs
Browse files Browse the repository at this point in the history
  • Loading branch information
coderatomy committed Oct 26, 2023
1 parent d244e10 commit 17e4eb0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions zubhub_frontend/zubhub/src/components/Sidenav/Sidenav.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
CircularProgress,
Link,
List,
ListItem,
ListItemIcon,
Expand All @@ -12,7 +11,7 @@ import clsx from 'clsx';
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory, useLocation } from 'react-router-dom';
import { useHistory, useLocation, Link } from 'react-router-dom';
import API from '../../api';
import { images } from '../../assets/images';
import { logout } from '../../store/actions/authActions';
Expand Down Expand Up @@ -56,7 +55,7 @@ export default function Sidenav() {
<div className={classes.container}>
<List className={classes.listContainer}>
{isSmallScreen && (
<Link className={clsx(classes.logo, classes.link)} href="/">
<Link className={clsx(classes.logo, classes.link)} to="/">
<ListItem>
<img alt="Zubhub Logo" src={images.logo} />
</ListItem>
Expand All @@ -69,7 +68,7 @@ export default function Sidenav() {
<Link
key={index + label}
className={clsx(classes.label, classes.link, pathname == link && classes.active, red && classes.red)}
href={link}
to={link}
target={target || '_self'}
>
<ListItem key={label}>
Expand All @@ -89,7 +88,7 @@ export default function Sidenav() {
key={index + label}
className={clsx(classes.label, classes.link, pathname == link && classes.active, red && classes.red)}
style={{ marginTop: index == 0 && 'auto' }}
{...(link && { href: link })}
{...(link && { to: link })}
onClick={action == 'logout' ? handleLogout : null}
>
<ListItem key={label}>
Expand Down

0 comments on commit 17e4eb0

Please sign in to comment.