Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add <Link> instead of navigating programmatically when going detail pages #153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"react-ga": "^3.3.0",
"react-icons": "^4.1.0",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-router-dom": "^5.3.0",
"react-scripts": "^4.0.3",
"react-toggle": "^4.1.2",
"react-use-localstorage": "^3.5.3",
Expand Down
9 changes: 5 additions & 4 deletions src/components/Content/CardExporter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from "react";
import { withRouter } from "react-router-dom";
import { withRouter, Link } from "react-router-dom";
import axios from "axios";
import styled from "styled-components";
import { AiFillStar } from "react-icons/ai";
Expand All @@ -11,7 +11,6 @@ import { EXPORTER_API } from "../../config";

const CardExporter = ({
exporter,
cardClick,
fork,
mybucket,
setIsForkModalActive,
Expand Down Expand Up @@ -86,7 +85,8 @@ const CardExporter = ({
)}
</span>
</header>
<Article onClick={() => cardClick(exporter_id)}>
<Article>
<Link to={ `/detail/${exporter_id}` }>
<div>
<img src={logo_url} alt={name} />
</div>
Expand All @@ -98,7 +98,8 @@ const CardExporter = ({
</div>
<p>{description}</p>
</Section>
</Article>
</Link>
</Article>
{fork && (
<Unfork onClick={(e) => unforkRepo(e, exporter_id)} className="unfork">
<div>
Expand Down
5 changes: 0 additions & 5 deletions src/components/Content/ContentExporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ const ContentExporters = ({
location: { pathname },
} = useHistory();

const goToDetail = (id) => {
push(`/detail/${id}`);
};

return (
<ExporterContainer fork={fork} mybucket={mybucket}>
{exporters &&
exporters.map((exporter) => (
<CardExporter
key={exporter.exporter_id}
cardClick={pathname === "/" ? goToDetail : goToDetail}
fork={fork}
mybucket={mybucket}
setIsForkModalActive={setIsForkModalActive}
Expand Down