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')
|
||||
const dateFormat = require('../lib/date').dateFormat
|
||||
import React from 'react'
|
||||
import { dateFormat } from '../lib/date'
|
||||
|
||||
const Tag = ({children}) => (
|
||||
const Tag = ({ children }) => (
|
||||
<li className="ArticleTags-Item">
|
||||
{children}
|
||||
</li>
|
||||
)
|
||||
|
||||
const TagList = ({tags}) => (
|
||||
const TagList = ({ tags }) => (
|
||||
<ul className="ArticleTags">
|
||||
{tags.map((x, i) => (
|
||||
<Tag key={i}># {x.name}</Tag>
|
||||
@@ -15,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 +24,7 @@ const Head = ({date, tags = [], children}) => (
|
||||
)}
|
||||
|
||||
{!(tags.length) ? null : (
|
||||
<TagList tags={tags}/>
|
||||
<TagList tags={tags} />
|
||||
)}
|
||||
</header>
|
||||
)
|
||||
@@ -38,7 +38,7 @@ const Share = () => (
|
||||
</div>
|
||||
)
|
||||
|
||||
const Article = ({children, date, tags, title, shareable}) => (
|
||||
const Article = ({ children, date, tags, title, shareable }) => (
|
||||
<article className="Article">
|
||||
<Head
|
||||
date={date}
|
||||
@@ -52,9 +52,9 @@ const Article = ({children, date, tags, title, shareable}) => (
|
||||
</div>
|
||||
|
||||
{!shareable ? null : (
|
||||
<Share/>
|
||||
<Share />
|
||||
)}
|
||||
</article>
|
||||
)
|
||||
|
||||
module.exports = Article
|
||||
export default Article
|
||||
Reference in new issue
Block a user