Skip to content

Commit f67d57d

Browse files
committed
refactor: create separate announcement layout
1 parent 3a4cd15 commit f67d57d

6 files changed

Lines changed: 44 additions & 10 deletions

File tree

src/components/Announcement.astro

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
import type { CollectionEntry } from "astro:content";
3+
4+
interface Props {
5+
announcement: CollectionEntry<"announcements">;
6+
}
7+
const { announcement } = Astro.props;
8+
---
9+
10+
<div>
11+
<h1 class="text-xl text-gray-900 dark:text-gray-100 tracking-wider">
12+
{announcement.data.title}
13+
</h1>
14+
<h1 class="text-gray-600 dark:text-gray-400">
15+
{announcement.data.description}
16+
</h1>
17+
<div class="prose dark:prose-invert text-gray-600 dark:text-gray-400 my-8">
18+
<slot />
19+
</div>
20+
</div>
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
---
22
title: "Internships and entry level positions"
3-
pubDate: 2023-07-03
43
description: "Seeking challenging internships and entry-level positions to apply and enhance my coding skills"
5-
tags: ["internships", "work"]
6-
draft: true
4+
show: false
75
---
86

97
Hi! My name is Milan, I'm a motivated and ambitious second-year CS student with a strong desire to gain practical experience in the field. Seeking challenging internships and entry-level positions to apply and enhance my coding skills, contribute to real-world projects, and learn from industry professionals. Committed to delivering high-quality work, collaborating effectively in team environments, and continuously expanding my knowledge. If you think I'd be a good fit in your team, contact me at milanherke@protonmail.com!

src/content/config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ const announcementCollection = defineCollection({
1616
schema: z.object({
1717
title: z.string().min(1),
1818
description: z.string().min(1),
19-
tags: z.array(z.string().min(1)).min(1),
20-
pubDate: z.date(),
21-
draft: z.boolean(),
19+
show: z.boolean(),
2220
}),
2321
});
2422

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
import type { CollectionEntry } from "astro:content";
3+
import Navbar from "../components/Navbar.astro";
4+
import BaseLayout from "./BaseLayout.astro";
5+
import Announcement from "../components/Announcement.astro";
6+
7+
interface Props {
8+
announcement: CollectionEntry<"announcements">;
9+
}
10+
const { announcement } = Astro.props;
11+
---
12+
13+
<BaseLayout title={announcement.data.title}>
14+
<Navbar />
15+
<Announcement announcement={announcement}>
16+
<slot />
17+
</Announcement>
18+
</BaseLayout>

src/layouts/PostLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Navbar from "../components/Navbar.astro";
55
import BaseLayout from "./BaseLayout.astro";
66
77
interface Props {
8-
post: CollectionEntry<"blog"> | CollectionEntry<"announcements">;
8+
post: CollectionEntry<"blog">;
99
}
1010
const { post } = Astro.props;
1111
---

src/pages/announcement/[...slug].astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
import { getCollection } from "astro:content";
3-
import PostLayout from "../../layouts/PostLayout.astro";
3+
import AnnouncementLayout from "../../layouts/AnnouncementLayout.astro";
44
55
export async function getStaticPaths() {
66
const announcements = await getCollection("announcements");
@@ -14,6 +14,6 @@ const { entry } = Astro.props;
1414
const { Content } = await entry.render();
1515
---
1616

17-
<PostLayout post={entry}>
17+
<AnnouncementLayout announcement={entry}>
1818
<Content />
19-
</PostLayout>
19+
</AnnouncementLayout>

0 commit comments

Comments
 (0)