Skip to content

Commit

Permalink
Merge pull request #63 from ram170/card-empty-state
Browse files Browse the repository at this point in the history
Empty states are not handled in about page contributors card #60
  • Loading branch information
BrandonArmand authored Oct 1, 2020
2 parents 643721b + 60a9025 commit 2c6a0a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/views/About/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Button from "components/CustomButtons/Button.js";
import Tooltip from "@material-ui/core/Tooltip";
import { styles } from "assets/jss/material-kit-react/views/about/components/cardStyle";
import PropTypes from "prop-types";
import { showDetail } from "../helpers";

const useStyles = makeStyles(styles);

Expand Down Expand Up @@ -42,7 +43,7 @@ const ContributorCard = props => {
<i className="fas fa-globe" /> Website
</Button>
)}
{props.commits && (
{showDetail(props.commits) && (
<Tooltip
title="Commits"
placement="right"
Expand All @@ -57,7 +58,7 @@ const ContributorCard = props => {
</div>
</Tooltip>
)}
{props.additions && (
{showDetail(props.additions) && (
<Tooltip
title="Additions"
placement="right"
Expand All @@ -72,7 +73,7 @@ const ContributorCard = props => {
</div>
</Tooltip>
)}
{props.deletions && (
{showDetail(props.deletions) && (
<Tooltip
title="Deletions"
placement="right"
Expand Down
4 changes: 4 additions & 0 deletions src/views/About/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ export function commitDel(arr) {
return (typeof a.d != "undefined" ? a.d : a) + b.d;
});
}

export function showDetail(val) {
return val ? true : null;
}

0 comments on commit 2c6a0a9

Please sign in to comment.