✨ Added Sb1 Actual integration to projects.
All checks were successful
Build and deploy website / build (push) Successful in 39s
All checks were successful
Build and deploy website / build (push) Successful in 39s
- Code style is Catppuccin Mocha - Added lang tag to project - Added keywords to project - Sort projects by latest updated
This commit is contained in:
@ -1,12 +1,8 @@
|
||||
---
|
||||
import { getCollection } from "astro:content"
|
||||
import ProjectGrid from "./ProjectGrid.astro"
|
||||
import { type CollectionEntry } from "astro:content"
|
||||
|
||||
interface Props {
|
||||
projects: CollectionEntry<"projects">[]
|
||||
}
|
||||
|
||||
const { projects } = Astro.props
|
||||
const projects = await getCollection("projects")
|
||||
---
|
||||
|
||||
<ProjectGrid projects={projects} />
|
||||
|
@ -2,6 +2,7 @@
|
||||
import type { Project } from "@/types/types"
|
||||
import type { NavLink } from "@/utils/linking"
|
||||
import ProjectCard from "./ProjectCard.astro"
|
||||
import dayjs from "dayjs"
|
||||
|
||||
interface Props {
|
||||
projects: ReadonlyArray<Project>
|
||||
@ -14,19 +15,26 @@ const baseUrl: NavLink = "/projects"
|
||||
|
||||
<div class="flex flex-wrap justify-around">
|
||||
{
|
||||
projects.map(
|
||||
({ data: { title, description, tags, heroImage, heroImageAlt }, id }) => (
|
||||
<div class="my-5 px-2">
|
||||
<ProjectCard
|
||||
title={title}
|
||||
linkTo={`${baseUrl}/${id}`}
|
||||
description={description}
|
||||
tags={tags}
|
||||
image={heroImage}
|
||||
imageAlt={heroImageAlt}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
)
|
||||
projects
|
||||
.toSorted((a, b) =>
|
||||
dayjs(a.data.updatedAt).isBefore(dayjs(b.data.updatedAt)) ? 1 : -1,
|
||||
)
|
||||
.map(
|
||||
({
|
||||
data: { title, description, tags, heroImage, heroImageAlt },
|
||||
id,
|
||||
}) => (
|
||||
<div class="my-5 px-2">
|
||||
<ProjectCard
|
||||
title={title}
|
||||
linkTo={`${baseUrl}/${id}`}
|
||||
description={description}
|
||||
tags={tags}
|
||||
image={heroImage}
|
||||
imageAlt={heroImageAlt}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
)
|
||||
}
|
||||
</div>
|
||||
|
@ -18,6 +18,7 @@ const { project } = Astro.props
|
||||
const entry = await getEntry("projects", project)
|
||||
const { Content } = await render(entry!)
|
||||
const {
|
||||
lang,
|
||||
title,
|
||||
description,
|
||||
tags,
|
||||
@ -29,7 +30,10 @@ const {
|
||||
} = entry!.data
|
||||
|
||||
function localeDateString(isoString: string): string {
|
||||
return dayjs(isoString).locale(languageTag()).format("YYYY-MM-DD")
|
||||
if (languageTag() === "nb") {
|
||||
return dayjs(isoString).locale(languageTag()).format("DD/MM/YYYY")
|
||||
}
|
||||
return dayjs(isoString).locale(languageTag()).format("DD-MM-YYYY")
|
||||
}
|
||||
---
|
||||
|
||||
@ -53,5 +57,7 @@ function localeDateString(isoString: string): string {
|
||||
<GiteaLink href={source} class="my-2" />
|
||||
|
||||
<p class="my-2">{description}</p>
|
||||
<Content />
|
||||
<div lang={lang}>
|
||||
<Content />
|
||||
</div>
|
||||
</Layout>
|
||||
|
Reference in New Issue
Block a user