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

Added badge count to repo nav buttons to reflect number of issues. #62

Open
wants to merge 1 commit into
base: master
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
5 changes: 4 additions & 1 deletion src/components/Repo/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import React from 'react';

const Repo = ({ repo, changeRepo, repoPath }) => (
const Repo = ({ repo, changeRepo, repoPath, repoIssues }) => (
<div className="repoSwitches">
<button className="btn btn-subnav" onClick={() => changeRepo(repoPath)}>
{repo}
<span className="badge">{repoIssues}</span>
</button>
</div>
);

Repo.propTypes = {
repo: React.PropTypes.string.isRequired,
repoPath: React.PropTypes.string,
repoIssues: React.PropTypes.number,
changeRepo: React.PropTypes.func.isRequired,
};

Repo.defaultProps = {
repo: {},
repoPath: '',
repoIssues: 0,
};
export default Repo;
1 change: 1 addition & 0 deletions src/components/ReposList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const ReposList = ({ repos, changeRepo }) => (
key={repo.path}
repo={repo.name}
repoPath={repo.path}
repoIssues={repo.open_issues_count}
changeRepo={changeRepo}
/>,
)}
Expand Down
10 changes: 10 additions & 0 deletions src/css/components/_buttons.sass
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@
background-color: $pink
color: $white
border: 3px solid $pink
span
&.badge
background-color: $white
color: $pink
span
&.badge
background-color: $pink
border-radius: 1rem
margin-left: 0.8em
padding: 0.3em 0.5em