Sha256: 40238b502eed5437aca3da57b06720276fb598708c9e9d233bb1c4bce2d14b3f

Contents?: true

Size: 912 Bytes

Versions: 2

Compression:

Stored size: 912 Bytes

Contents

import React from "react";
import PropTypes from "prop-types";
import { Services } from "loco-js";

import ArticleModel from "models/Article";

function Article({ article }) {
  const date = new Services.Date(article.publishedAt).toString("short");

  return (
    <article id={`article_${article.id}`}>
      <h2>{article.title}</h2>
      <p>
        <i>
          {article.author} wrote this on {date} /{" "}
          <a
            href={`/articles/${article.id}#comments`}
            className="comments_quantity"
          >
            {article.commentsCount} comment
            {article.commentsCount === 1 ? "" : "s"}
          </a>
        </i>
      </p>
      <p>{article.content}</p>
      <p>
        <a href={`/articles/${article.id}`}>Continued…</a>
      </p>
    </article>
  );
}

Article.propTypes = {
  article: PropTypes.instanceOf(ArticleModel).isRequired
};

export default Article;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loco-rails-3.0.5 test/dummy/frontend/js/components/main/Article.js
loco-rails-3.0.4 test/dummy/frontend/js/components/main/Article.js