refactor: change nav icons to use Link instead of history.push

This commit is contained in:
Jordan Knott 2021-01-05 19:10:07 -06:00
parent f9e6fba552
commit dc50ef3566
2 changed files with 10 additions and 4 deletions

View File

@ -65,6 +65,11 @@ export const ProfileNameWrapper = styled.div`
line-height: 1.25; line-height: 1.25;
`; `;
export const NavbarLink = styled(Link)`
margin-right: 20px;
cursor: pointer;
`;
export const IconContainerWrapper = styled.div<{ disabled?: boolean }>` export const IconContainerWrapper = styled.div<{ disabled?: boolean }>`
margin-right: 20px; margin-right: 20px;
cursor: pointer; cursor: pointer;

View File

@ -7,6 +7,7 @@ import { RoleCode } from 'shared/generated/graphql';
import NOOP from 'shared/utils/noop'; import NOOP from 'shared/utils/noop';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import { import {
NavbarLink,
TaskcafeLogo, TaskcafeLogo,
TaskcafeTitle, TaskcafeTitle,
ProjectFinder, ProjectFinder,
@ -310,12 +311,12 @@ const NavBar: React.FC<NavBarProps> = ({
<ProjectFinder onClick={onOpenProjectFinder} variant="gradient"> <ProjectFinder onClick={onOpenProjectFinder} variant="gradient">
Projects Projects
</ProjectFinder> </ProjectFinder>
<IconContainer onClick={() => onDashboardClick()}> <NavbarLink to="">
<HomeDashboard width={20} height={20} /> <HomeDashboard width={20} height={20} />
</IconContainer> </NavbarLink>
<IconContainer onClick={() => onMyTasksClick()}> <NavbarLink to="/tasks">
<CheckCircle width={20} height={20} /> <CheckCircle width={20} height={20} />
</IconContainer> </NavbarLink>
<IconContainer disabled onClick={NOOP}> <IconContainer disabled onClick={NOOP}>
<ListUnordered width={20} height={20} /> <ListUnordered width={20} height={20} />
</IconContainer> </IconContainer>