💄 Better history

This commit is contained in:
LittleSheep 2024-01-20 23:38:08 +08:00
parent c80003459e
commit 24292348d3
3 changed files with 16 additions and 7 deletions

View File

@ -2,11 +2,14 @@
import RootLayout from "../layouts/RootLayout.astro";
import { client } from "../..//tina/__generated__/client";
import { TinaMarkdown } from "tinacms/dist/rich-text";
const eventsResponse = await client.queries.eventConnection();
const events = eventsResponse.data.eventConnection.edges
?.reverse()
?.sort((a, b) =>
new Date(a?.node?.date ?? 0).getTime() <= new Date(b?.node?.date ?? 0).getTime()
? -1
: 0
)
.map((event) => {
return { ...event?.node, slug: event?.node?._sys.filename };
});
@ -113,7 +116,9 @@ const events = eventsResponse.data.eventConnection.edges
年。自那年起我们一直在开发让人喜欢的开源软件。在我们这里,“取之于开源,用之于开源”
不仅是原则,更是我们信仰的座右铭。
</p>
<a href="#history" class="btn btn-primary btn-md pl-[24px]">查看「岁月史书」</a>
<a href="#history" class="btn btn-primary btn-md pl-[24px]"
>查看「岁月史书」</a
>
</div>
</div>
</div>
@ -152,9 +157,7 @@ const events = eventsResponse.data.eventConnection.edges
</div>
<div class="timeline-end timeline-box">
<h2 class="font-bold">{item.title}</h2>
<div class="line-clamp-2">
<TinaMarkdown content={item._body} />
</div>
<div class="line-clamp-2">{item.description}</div>
</div>
{idx < events?.length - 1 && <hr />}
</li>

View File

@ -29,6 +29,12 @@ const Event: Collection = {
name: "author",
collections: ["author"],
},
{
type: "string",
label: "Description",
name: "description",
required: true,
},
{
type: "datetime",
label: "Published Date",

File diff suppressed because one or more lines are too long