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 Nov 12, 2023
1 parent 7520ce0 commit 7328e5e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 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 @@ -67,7 +66,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 @@ -82,7 +81,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 Down Expand Up @@ -114,7 +113,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 @@ -138,7 +137,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 7328e5e

Please sign in to comment.