Skip to content

Commit 03b3b5e

Browse files
committed
feat(projects): add links to repo cards
1 parent 056fec6 commit 03b3b5e

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

src/components/GithubCard.tsx

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
import React from "react";
22
import "../styles/components/RepoCard.css";
33
import { REPO_DATA_TYPE } from "../utils/types";
4+
import { Link } from "react-router-dom";
45

56
const RepoCard = ({ repoData }: { repoData: REPO_DATA_TYPE }) => {
7+
const repo_link = `https://github.com/metakgp/${repoData.name}`;
8+
const stargazers_link = `https://github.com/metakgp/${repoData.name}/stargazers`
9+
const forks_link = `https://github.com/metakgp/${repoData.name}/forks`
10+
611
return (
7-
<div className="gh-card-container">
12+
<Link to={repo_link} className="gh-card-container">
813
<div className="gh-card-header">
914
<span className="book-icon">
1015
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" className="octicon octicon-repo mr-1 color-fg-muted">
1116
<path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path>
1217
</svg>
1318
</span>
14-
<span className="gh-repo-name">{repoData.name}</span>
19+
<Link to={repo_link}>
20+
<span className="gh-repo-name">{repoData.name}</span>
21+
</Link>
1522
</div>
1623
<div className="gh-card-body">
1724
{repoData.description}
@@ -21,24 +28,28 @@ const RepoCard = ({ repoData }: { repoData: REPO_DATA_TYPE }) => {
2128
<span className="gh-card-circle"></span>
2229
<span className="gh-card-language">{repoData.language}</span>
2330
</div>
24-
<div className="gh-card-star-container">
25-
<span className="gh-card-star-icon">
26-
<svg aria-label="stars" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" className="octicon octicon-star">
27-
<path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path>
28-
</svg>
29-
</span>
30-
{repoData.stars}
31-
</div>
32-
<div className="gh-card-forks-container">
33-
<span className="gh-card-fork-icon">
34-
<svg aria-label="forks" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" className="octicon octicon-repo-forked">
35-
<path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path>
36-
</svg>
37-
</span>
38-
{repoData.forks}
39-
</div>
31+
<Link to={stargazers_link}>
32+
<div className="gh-card-star-container">
33+
<span className="gh-card-star-icon">
34+
<svg aria-label="stars" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" className="octicon octicon-star">
35+
<path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path>
36+
</svg>
37+
</span>
38+
{repoData.stars}
39+
</div>
40+
</Link>
41+
<Link to={forks_link}>
42+
<div className="gh-card-forks-container">
43+
<span className="gh-card-fork-icon">
44+
<svg aria-label="forks" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" className="octicon octicon-repo-forked">
45+
<path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path>
46+
</svg>
47+
</span>
48+
{repoData.forks}
49+
</div>
50+
</Link>
4051
</div>
41-
</div>
52+
</Link>
4253
)
4354
}
4455

src/styles/components/RepoCard.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
text-wrap: wrap;
2828
overflow-x: hidden;
2929
padding: 0.5rem 0;
30-
color: #333
30+
color: #333;
31+
text-align: left;
32+
width: 100%;
3133
}
3234

3335
.gh-card-footer {
@@ -57,6 +59,10 @@
5759

5860
/* Footer Objects */
5961

62+
.gh-card-footer {
63+
color: #000;
64+
}
65+
6066
.gh-card-circle {
6167
width: 12px;
6268
height: 12px;
@@ -70,6 +76,7 @@
7076
display: flex;
7177
justify-content: center;
7278
align-items: center;
79+
color: #000;
7380
}
7481

7582
.gh-card-star-icon {
@@ -83,6 +90,7 @@
8390
display: flex;
8491
justify-content: center;
8592
align-items: center;
93+
color: #000;
8694
}
8795

8896
.gh-card-fork-icon {

0 commit comments

Comments
 (0)