[www] Article Head refactoring

This commit is contained in:
Roman Timashev committed 2017-10-15 21:33:50 +03:00
1 parent a041fd25bf
commit cbd0fa0688
1 file changed
+11 -10
+11 -10
View File
@@ -2,10 +2,14 @@ const React = require('react')
const getHtml = require('../lib/component').getHtml
const dateFormat = require('../lib/date').dateFormat
const Head = ({url, children}) => (
!url
? <h1>{children}</h1>
: <a href={url}><h2>{children}</h2></a>
const Head = ({date, children}) => (
<header className="Article-Head">
<h1>{children}</h1>
{!date ? null : (
<p className="date">{dateFormat(date)}</p>
)}
</header>
)
const Share = () => (
@@ -19,12 +23,9 @@ const Share = () => (
const Article = ({children, data, url, title, date, shareable}) => (
<article className="Article">
<header className="Article-Head">
<Head url={url}>{title}</Head>
{!date ? null : (
<p className="date">{dateFormat(date)}</p>
)}
</header>
<Head date={date}>
{title}
</Head>
<div className="Article-Body">
{children || getHtml(data)}