[www] Article component signature changed

This commit is contained in:
Roman Timashev committed 2017-10-28 17:25:52 +03:00
1 parent e39d732dbd
commit 280fd105d7
2 files changed
+14 -10

No files matched your search

+7 -8
View File
@@ -1,5 +1,4 @@
const React = require('react')
const getHtml = require('../lib/component').getHtml
const dateFormat = require('../lib/date').dateFormat
const Tag = ({children}) => (
@@ -16,7 +15,7 @@ const TagList = ({tags}) => (
</ul>
)
const Head = ({date, tags, children}) => (
const Head = ({date, tags = [], children}) => (
<header className="Article-Head">
<h1>{children}</h1>
@@ -24,7 +23,7 @@ const Head = ({date, tags, children}) => (
<p className="date">{dateFormat(date)}</p>
)}
{!tags.length ? null : (
{!(tags.length) ? null : (
<TagList tags={tags}/>
)}
</header>
@@ -39,17 +38,17 @@ const Share = () => (
</div>
)
const Article = ({children, article, shareable}) => (
const Article = ({children, date, tags, title, shareable}) => (
<article className="Article">
<Head
date={article.date}
tags={article.tags}
date={date}
tags={tags}
>
{article.title}
{title}
</Head>
<div className="Article-Body">
{children || getHtml(article.post)}
{children}
</div>
{!shareable ? null : (
+7 -2
View File
@@ -6,6 +6,7 @@ const {render} = require('../lib/render')
const timestamp = require('../lib/date').timestamp
const ImageArtifactType = require('../core/ImageArtifactType')
const {sortBy} = require('../utils/sort')
const getHtml = require('../lib/component').getHtml
const sortArticleByDate = sortBy(
x => timestamp(new Date(x.date))
@@ -112,9 +113,13 @@ async function renderArticle(id) {
const Component = (
<div className="content content_thin">
<ArticleComponent
article={article}
title={article.title}
date={article.date}
tags={article.tags}
shareable={true}
/>
>
{getHtml(article.post)}
</ArticleComponent>
</div>
)