Sha256: a7bf3ee3546913f75bdfe6a3680237c89d806425aff83996e90db5699fcd827c

Contents?: true

Size: 846 Bytes

Versions: 2

Compression:

Stored size: 846 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} /{" "}
          <span className="comments_quantity">
            {article.commentsCount} comment
            {article.commentsCount === 1 ? "" : "s"}
          </span>
        </i>
      </p>
      <p>{article.content}</p>
      <p>
        <a href={`/admin/articles/${article.id}/edit`}>Review</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/admin/Article.js
loco-rails-3.0.4 test/dummy/frontend/js/components/admin/Article.js