article card uses next link
This commit is contained in:
1 parent
0b47b12d27
commit
93d9021ac0
1 file changed
+25
-22
@@ -3,6 +3,7 @@ import './styles.css'
|
|||||||
import cx from 'classnames'
|
import cx from 'classnames'
|
||||||
import { Date } from './Date'
|
import { Date } from './Date'
|
||||||
import { IImage } from 'src/types'
|
import { IImage } from 'src/types'
|
||||||
|
import Link from 'next/link'
|
||||||
|
|
||||||
export interface IArticleCardProps {
|
export interface IArticleCardProps {
|
||||||
article: any
|
article: any
|
||||||
@@ -11,29 +12,31 @@ export interface IArticleCardProps {
|
|||||||
|
|
||||||
export const ArticleCard: React.FC<IArticleCardProps> = ({ article, ...props }) => (
|
export const ArticleCard: React.FC<IArticleCardProps> = ({ article, ...props }) => (
|
||||||
<section className="ArticleCard">
|
<section className="ArticleCard">
|
||||||
<a className="invisible" href={article.url}>
|
<Link href={article.url}>
|
||||||
<div className="ArticleCard-image">
|
<a className="invisible">
|
||||||
{!props.preview ? null : (
|
<div className="ArticleCard-image">
|
||||||
<picture>
|
{!props.preview ? null : (
|
||||||
<img
|
<picture>
|
||||||
className={cx({ opa: false })}
|
<img
|
||||||
alt={props.preview.alt}
|
className={cx({ opa: false })}
|
||||||
src={props.preview.src}
|
alt={props.preview.alt}
|
||||||
srcSet={props.preview.srcSet.map(({ url, density }) => `${url} ${density}x`).join(' ')}
|
src={props.preview.src}
|
||||||
/>
|
srcSet={props.preview.srcSet.map(({ url, density }) => `${url} ${density}x`).join(' ')}
|
||||||
</picture >
|
/>
|
||||||
)}
|
</picture >
|
||||||
</div>
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="ArticleCard-body">
|
<div className="ArticleCard-body">
|
||||||
{article.title}
|
{article.title}
|
||||||
|
|
||||||
{!article.date ? null : (
|
{!article.date ? null : (
|
||||||
<Date>
|
<Date>
|
||||||
{article.date}
|
{article.date}
|
||||||
</Date>
|
</Date>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
</Link>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
Reference in new issue
Block a user