Skip to content

Commit 512cef0

Browse files
committed
use RSSButton
1 parent 06752da commit 512cef0

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

src/components/RSSButton.astro

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
---
22
import { z } from "astro:schema";
33
import { Icon } from "@astrojs/starlight/components";
4+
import type { StarlightIcon } from "@astrojs/starlight/types";
45
56
const props = z
67
.object({
7-
changelog: z
8-
.string()
9-
.transform((val) => val.toLowerCase().replaceAll(" ", "-")),
8+
text: z.string().default("Subscribe to RSS"),
9+
icon: z.custom<StarlightIcon>().default("rss"),
1010
})
11-
.or(
12-
z.object({
13-
href: z.string(),
14-
}),
11+
.and(
12+
z
13+
.object({
14+
changelog: z
15+
.string()
16+
.transform((val) => val.toLowerCase().replaceAll(" ", "-")),
17+
})
18+
.or(
19+
z.object({
20+
href: z.string(),
21+
}),
22+
),
1523
);
1624
1725
const input = props.parse(Astro.props);
@@ -22,6 +30,6 @@ const input = props.parse(Astro.props);
2230
class="inline-flex items-center justify-center gap-1 rounded font-semibold no-underline"
2331
target="_blank"
2432
>
25-
Subscribe to RSS
26-
<Icon name="rss" size="1.25rem" />
33+
{input.text}
34+
<Icon name={input.icon} size="1.25rem" />
2735
</a>

src/components/changelog/Header.astro

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { Image } from "astro:assets";
33
import { z } from "astro:schema";
44
import { getEntry, type CollectionEntry } from "astro:content";
55
6-
import { StarlightIcon } from "..";
6+
import { Icon } from "@astrojs/starlight/components";
7+
import RSSButton from "~/components/RSSButton.astro";
8+
79
import HeroImage from "~/assets/images/changelog/hero.svg";
810
911
type Props = z.input<typeof props>;
@@ -35,21 +37,11 @@ const products = await uniqueProducts(notes);
3537
<div class="text-center sm:text-left">
3638
<h1>Changelog</h1>
3739
<p>New updates and improvements at Cloudflare.</p>
38-
<div class="changelog-rss-links">
39-
<a
40-
href="/changelog/rss/index.xml"
41-
class="dark:!hover:text-[#79B1FF] -mx-2 whitespace-nowrap px-2 text-[#056DFF] no-underline hover:rounded-[4px] hover:bg-[#DCEBFF] hover:!text-[#056DFF] dark:text-[#79B1FF] dark:hover:bg-[#002B66] max-sm:block"
42-
>
43-
Subscribe to RSS
44-
<StarlightIcon name="rss" size="18px" class="!inline align-text-top" />
45-
</a>
46-
<a
47-
href="/fundamentals/new-features/available-rss-feeds/"
48-
class="dark:!hover:text-[#79B1FF] -mx-2 whitespace-nowrap px-2 text-[#056DFF] no-underline hover:rounded-[4px] hover:bg-[#DCEBFF] hover:!text-[#056DFF] dark:text-[#79B1FF] dark:hover:bg-[#002B66] max-sm:block"
49-
>
50-
View all RSS feeds &gt;
51-
</a>
52-
</div>
40+
<p>
41+
<RSSButton changelog="index" />
42+
<br />
43+
<RSSButton href="index" text="View all RSS feeds" icon="right-caret" />
44+
</p>
5345
{
5446
products.length > 0 && (
5547
<div>

0 commit comments

Comments
 (0)