-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05bb4e8
commit d2eac19
Showing
4 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import PageCard from "./PageCard"; | ||
import strapi from "@/strapi"; | ||
import { ApiNewsNews } from "@/types/generated/contentTypes"; | ||
|
||
export default async function NewsCard({ | ||
id, | ||
vertical, | ||
}: { | ||
id: number; | ||
vertical?: boolean; | ||
}) { | ||
const event = await strapi.findOne<ApiNewsNews>("newss", id, { | ||
populate: "picture", | ||
}); | ||
|
||
return ( | ||
<> | ||
<PageCard | ||
imageUrl={event.data.attributes.picture.data?.attributes?.url} | ||
title={event.data.attributes.news_title} | ||
text={event.data.attributes.small_description} | ||
vertical={vertical} | ||
date={event.data.attributes.createdAt} | ||
url={`/news/${id}`} | ||
/> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import NewsCard from "./NewsCard"; | ||
import Title from "./Title"; | ||
import strapi from "@/strapi"; | ||
import { ApiNewsNews } from "@/types/generated/contentTypes"; | ||
|
||
export default async function EventsGrid() { | ||
const events = await strapi.find<(ApiNewsNews & { id: number })[]>("newss", { | ||
fields: ["publication"], | ||
pagination: { start: 0, limit: 3 }, | ||
sort: ["publication:desc"], | ||
}); | ||
events.data.sort( | ||
(a, b) => | ||
new Date(a.attributes.createdAt as string).getTime() - | ||
new Date(b.attributes.createdAt as string).getTime() | ||
); | ||
|
||
return ( | ||
<div className="p-10 flex flex-col items-center"> | ||
<Title | ||
text="News" | ||
textSize="text-5xl font-bold" | ||
lineSize="w-24 h-1" | ||
dark={false} | ||
/> | ||
<div className="grid grid-cols-3 mt-6 gap-10"> | ||
{events.data.map((e) => ( | ||
<NewsCard id={e.id} vertical /> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |