haysclark/gatsby-starter-casper

View on GitHub
src/components/AuthorStats/AuthorStats.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import React from "react";

class AuthorStats extends React.Component {
  render() {
    const { postEdges } = this.props;
    const getPostText = () => {
      if (postEdges) {
        return postEdges.length > 1
          ? `${postEdges.length} posts`
          : `${postEdges.length} post`;
      }
      return "No posts";
    };
    return (
      <span className="author-stats">
        <i className="icon-stats" />
        {getPostText()}
      </span>
    );
  }
}

export default AuthorStats;