Skip to content

Commit 5845dc6

Browse files
committed
Style updates for when top languages are missing
1 parent c7bdce9 commit 5845dc6

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-github-stats-card-v2",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"license": "MIT",
55
"description": "GitHub Stats card component for React applications.",
66
"main": "dist/index.js",

src/components/Card/card.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
.github-stats-card h5 span {display: flex; flex-direction: row; flex-wrap: nowrap; margin: 0 5px; box-sizing: border-box; font-size: 13px; line-height: 18px; vertical-align: middle;}
1212
.github-stats-card h5 span b { margin-right: 3px; font-size: 16px;}
1313
.github-stats-card ol, ul {max-width: 100%; display: flex; flex-direction: column; align-items: center; margin: 0; padding: 0 0 10px 10px;}
14-
.github-stats-card ol {list-style: none; display: flex; width: 100%; flex-direction: row; padding-bottom: 10px; border-bottom: 1px solid #f5f5f5; margin-bottom: 10px; text-align: center; justify-content: space-around;}
15-
14+
.github-stats-card ol {list-style: none; display: flex; width: 100%; flex-direction: row; padding-bottom: 10px; text-align: center; justify-content: space-around;}
15+
hr {display: flex; flex-direction: column; width: 100%; border: 0; border-bottom: 1px solid #efefef;}
1616
.github-stats-card ol li:first-of-type { order: 2; }
1717
.github-stats-card ol li:nth-of-type(2) { order: 1; }
1818
.github-stats-card ol li:last-of-type { order: 3; }

src/components/Card/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function Card({...props}) {
7878
'method': 'GET',
7979
'headers': {
8080
'Accept': 'application/vnd.github.v3+json',
81-
'User-Agent': `@cnocon/react-github-stats-card-v2`,
81+
'User-Agent': `react-github-stats-card-v2`,
8282
'Authorization': `token ${accessToken}`
8383
}
8484
};
@@ -87,7 +87,7 @@ function Card({...props}) {
8787
'method': 'GET',
8888
'headers': {
8989
'Accept': 'application/vnd.github.v3+json',
90-
'User-Agent': `@cnocon/github-stats-card-v2`
90+
'User-Agent': `react-github-stats-card-v2`
9191
}
9292
};
9393
}
@@ -117,7 +117,6 @@ function Card({...props}) {
117117
const following = <li>Following <b>{user.following}</b> {pluralizer(parseInt(user.following), `member`)}</li>;
118118
const openIssues = <li><b>{openIssuesCount}</b>&nbsp;{pluralizer(parseInt(openIssuesCount), `open issue`)}</li>;
119119
const company = !user.company ? `` : <p>Currently at {user.company}</p>;
120-
const location = !user.location ? `` : <p>{user.location}</p>;
121120

122121
const profileLink = <p><a href={user.html_url} target='_blank' rel='noreferrer nofollow'>@{user.login} on GitHub</a></p>
123122
const fullName = !user.name ? `` : <p><b>{user.name}</b></p>;
@@ -128,6 +127,7 @@ function Card({...props}) {
128127
const totalYears = Math.round(relativeDate / 1000 / 60 / 60 / 24 / 365);
129128
const yearsOnGitHub = <p>{totalYears} {pluralizer(totalYears, 'Year')} of Membership</p>;
130129
const footer = <footer><section>{profileLink}{yearsOnGitHub}{company}</section><img src="https://github.githubassets.com/images/icons/emoji/octocat.png?v8" alt="Octocat"/></footer>;
130+
const rule = languagesMarkup.length ? <hr/> : ``;
131131

132132

133133
useEffect(() => {
@@ -144,7 +144,7 @@ function Card({...props}) {
144144
<div className={theme ? 'github-stats-card' : ''}>
145145
<header>
146146
<h3><a href={user.html_url} target="_blank" rel="noopener nofollow">@{username}</a>&nbsp;on GitHub</h3>{user && user.bio ? <h4>{user.bio}</h4> : ``}<h5><span><b>{user.public_repos}</b>Public Repos</span><span>|</span><span><b>{user.public_gists}</b>Public Gists</span></h5></header>
147-
<div><p><b>Top Languages</b></p><ol>{languagesMarkup}</ol><ul>{openIssues}{watchers}{stargazers}{followers}{following}</ul></div>
147+
<div>{languagesMarkup.length ? <p><b>Top Languages</b></p> : ``}<ol>{languagesMarkup}</ol>{rule}<ul>{openIssues}{watchers}{stargazers}{followers}{following}</ul></div>
148148
{footer}
149149
</div>
150150
)

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// /src/index.js
22

33
import Card from './components/Card/index.js'
4-
export { Card }
4+
export { Card }

0 commit comments

Comments
 (0)