meta value updates

- prevent posts count from showing in non-series-home pages
- add an "s" only when there are multiple values
This commit is contained in:
Kim, Jimin 2022-01-17 18:04:03 +09:00
parent 79059267bd
commit 6bc48a6905

View file

@ -22,12 +22,14 @@ const Meta = (props: { fetchedPage: PageData }) => {
return ( return (
<StyledMetaContainer> <StyledMetaContainer>
{/* posts count */} {/* posts count */}
<FontAwesomeIcon icon={faFile} /> {props.fetchedPage.length > 0 && (
&nbsp;&nbsp; <>
{props.fetchedPage.length <FontAwesomeIcon icon={faFile} />
? props.fetchedPage.length + " posts" &nbsp;&nbsp;
: "no posts"} {props.fetchedPage.length} post
&nbsp;&nbsp;&nbsp;&nbsp; {props.fetchedPage.length > 1 && "s"} &nbsp;&nbsp;&nbsp;&nbsp;
</>
)}
{/* date */} {/* date */}
<FontAwesomeIcon icon={faCalendar} /> <FontAwesomeIcon icon={faCalendar} />
&nbsp;&nbsp; &nbsp;&nbsp;
@ -44,7 +46,9 @@ const Meta = (props: { fetchedPage: PageData }) => {
<FontAwesomeIcon icon={faBook} /> <FontAwesomeIcon icon={faBook} />
&nbsp;&nbsp; &nbsp;&nbsp;
{props.fetchedPage.wordCount {props.fetchedPage.wordCount
? props.fetchedPage.wordCount + " words" ? props.fetchedPage.wordCount +
" word" +
(props.fetchedPage.wordCount > 1 && "s")
: "unknown words"} : "unknown words"}
</StyledMetaContainer> </StyledMetaContainer>
) )