drop Article component
This commit is contained in:
1 parent
b680cba50c
commit
ee5cba3634
1 file changed
-55
@@ -1,55 +0,0 @@
|
|||||||
import { dateFormat } from 'src/lib/date'
|
|
||||||
import { Share } from '../Share'
|
|
||||||
import { TagList } from '../TagList'
|
|
||||||
import { ITag } from 'src/types'
|
|
||||||
|
|
||||||
export type ArticleProps = {
|
|
||||||
date: string
|
|
||||||
title: string
|
|
||||||
tags: ITag[]
|
|
||||||
shareable: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
type HeadProps = {
|
|
||||||
date: string
|
|
||||||
tags: ITag[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const Head: React.FC<HeadProps> = ({ date, tags = [], children }) => (
|
|
||||||
<header className="Article-Head">
|
|
||||||
<style jsx>{`
|
|
||||||
.date {
|
|
||||||
color: var(--color-text-second);
|
|
||||||
}
|
|
||||||
`}</style>
|
|
||||||
|
|
||||||
<h1>{children}</h1>
|
|
||||||
|
|
||||||
{!date ? null : (
|
|
||||||
<p className={'date'}>Опубликовано: {dateFormat(date)}</p>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!tags.length ? null : (
|
|
||||||
<TagList items={tags} />
|
|
||||||
)}
|
|
||||||
</header>
|
|
||||||
)
|
|
||||||
|
|
||||||
export const Article: React.FC<ArticleProps> = ({ children, date, tags, title, shareable }) => (
|
|
||||||
<article className="Article">
|
|
||||||
<Head
|
|
||||||
date={date}
|
|
||||||
tags={tags}
|
|
||||||
>
|
|
||||||
{title}
|
|
||||||
</Head>
|
|
||||||
|
|
||||||
<div className="Article-Body">
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{!shareable ? null : (
|
|
||||||
<Share />
|
|
||||||
)}
|
|
||||||
</article>
|
|
||||||
)
|
|
||||||
Reference in new issue
Block a user