Article component format
This commit is contained in:
1 parent
281940942f
commit
0ae9601309
1 file changed
+9
-9
@@ -1,13 +1,13 @@
|
|||||||
const React = require('react')
|
import React from 'react'
|
||||||
const dateFormat = require('../lib/date').dateFormat
|
import { dateFormat } from '../lib/date'
|
||||||
|
|
||||||
const Tag = ({children}) => (
|
const Tag = ({ children }) => (
|
||||||
<li className="ArticleTags-Item">
|
<li className="ArticleTags-Item">
|
||||||
{children}
|
{children}
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
|
|
||||||
const TagList = ({tags}) => (
|
const TagList = ({ tags }) => (
|
||||||
<ul className="ArticleTags">
|
<ul className="ArticleTags">
|
||||||
{tags.map((x, i) => (
|
{tags.map((x, i) => (
|
||||||
<Tag key={i}># {x.name}</Tag>
|
<Tag key={i}># {x.name}</Tag>
|
||||||
@@ -15,7 +15,7 @@ const TagList = ({tags}) => (
|
|||||||
</ul>
|
</ul>
|
||||||
)
|
)
|
||||||
|
|
||||||
const Head = ({date, tags = [], children}) => (
|
const Head = ({ date, tags = [], children }) => (
|
||||||
<header className="Article-Head">
|
<header className="Article-Head">
|
||||||
<h1>{children}</h1>
|
<h1>{children}</h1>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ const Head = ({date, tags = [], children}) => (
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{!(tags.length) ? null : (
|
{!(tags.length) ? null : (
|
||||||
<TagList tags={tags}/>
|
<TagList tags={tags} />
|
||||||
)}
|
)}
|
||||||
</header>
|
</header>
|
||||||
)
|
)
|
||||||
@@ -38,7 +38,7 @@ const Share = () => (
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const Article = ({children, date, tags, title, shareable}) => (
|
const Article = ({ children, date, tags, title, shareable }) => (
|
||||||
<article className="Article">
|
<article className="Article">
|
||||||
<Head
|
<Head
|
||||||
date={date}
|
date={date}
|
||||||
@@ -52,9 +52,9 @@ const Article = ({children, date, tags, title, shareable}) => (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!shareable ? null : (
|
{!shareable ? null : (
|
||||||
<Share/>
|
<Share />
|
||||||
)}
|
)}
|
||||||
</article>
|
</article>
|
||||||
)
|
)
|
||||||
|
|
||||||
module.exports = Article
|
export default Article
|
||||||
Reference in new issue
Block a user