changed post card from div to a

This commit is contained in:
Kim, Jimin 2022-02-14 10:15:20 +09:00
parent bc064e4307
commit 14737aa71d

View file

@ -1,5 +1,5 @@
import styled from "styled-components"
import { useNavigate } from "react-router-dom"
import { Link } from "react-router-dom"
import { PostData } from "../../types/types"
@ -55,12 +55,10 @@ interface Props {
const PostCard = (props: Props) => {
const { postData } = props
const navigate = useNavigate()
return (
<StyledPostCard
onClick={() => navigate(process.env.PUBLIC_URL + postData.url)}
>
<Link to={process.env.PUBLIC_URL + postData.url}>
<StyledPostCard>
<StyledTitle>
{postData?.title || "No title"}
{/* show (series for regex matching "/series/<series-title>") */}
@ -87,9 +85,12 @@ const PostCard = (props: Props) => {
&nbsp;&nbsp;&nbsp;&nbsp;
<FontAwesomeIcon icon={faBook} />
&nbsp;&nbsp;&nbsp;
{postData?.wordCount ? postData.wordCount + " words" : "unknown words"}
{postData?.wordCount
? postData.wordCount + " words"
: "unknown words"}
</StyledMetaContainer>
</StyledPostCard>
</Link>
)
}