Skip to content

Commit 8c7ce9b

Browse files
CopilotCalinator444
andcommitted
Add published date display to article listings page
Co-authored-by: Calinator444 <65635198+Calinator444@users.noreply.github.com>
1 parent 9ed675f commit 8c7ce9b

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

components/articles/articleCard.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { CustomLink } from "../customLink";
22
import ArticleAuthor from "./articleAuthor";
3+
import ArticleDate from "./articleDate";
34

45
export type ArticleProps = {
56
title: string;
@@ -8,6 +9,7 @@ export type ArticleProps = {
89
authorName: string | null;
910
authorPosition: string | null;
1011
authorImage: string | null;
12+
publishedDate?: string;
1113
};
1214

1315
export type ArticleCardProps = {
@@ -22,6 +24,7 @@ const ArticleCard = ({ data }: ArticleCardProps) => {
2224
authorName,
2325
authorPosition,
2426
url,
27+
publishedDate,
2528
}: ArticleProps = data;
2629
return (
2730
<CustomLink href={url ?? ""} className="unstyled no-underline">
@@ -31,6 +34,7 @@ const ArticleCard = ({ data }: ArticleCardProps) => {
3134
userImage={authorImage}
3235
userName={authorName}
3336
userPosition={authorPosition}
37+
publishedDate={publishedDate}
3438
/>
3539
</CustomLink>
3640
);
@@ -42,16 +46,20 @@ const ArticleCardContent = ({
4246
userName,
4347
userImage,
4448
userPosition,
49+
publishedDate,
4550
}) => {
4651
return (
4752
<div className="size-full bg-white">
4853
<div>
4954
<h2 className="my-1">{title}</h2>
50-
<ArticleAuthor
51-
name={userName}
52-
position={userPosition}
53-
image={userImage}
54-
/>
55+
<div className="flex flex-row items-center gap-2 py-1">
56+
<ArticleAuthor
57+
name={userName}
58+
position={userPosition}
59+
image={userImage}
60+
/>
61+
<ArticleDate publishedDate={publishedDate} />
62+
</div>
5563
<div className="font-normal prose-p:mt-0">{body}</div>
5664
</div>
5765
</div>

components/articles/articlesList.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const ArticlesList = () => {
1717
author,
1818
title,
1919
seo,
20+
publishedDate,
2021
_sys: { filename },
2122
} = article;
2223
const description = seo?.description ?? null;
@@ -27,6 +28,7 @@ const ArticlesList = () => {
2728
authorName: author?.presenter?.name,
2829
authorPosition: author?.position,
2930
body: description,
31+
publishedDate,
3032
};
3133

3234
return <ArticleCard data={prop} key={`article-card-${index}`} />;

0 commit comments

Comments
 (0)