Skip to content

Commit 3f13fd2

Browse files
kodster28KianNH
andauthored
[Changelog] Add other RSS feeds button (#21007)
* [Changelog] Add other RSS feeds button * reformat * Update link * remove spaces * styling update * test * eslint * Fix link :) --------- Co-authored-by: Kian Newman-Hazel <[email protected]>
1 parent 52ddd22 commit 3f13fd2

File tree

2 files changed

+39
-18
lines changed

2 files changed

+39
-18
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: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ 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 RSSButton from "~/components/RSSButton.astro";
7+
78
import HeroImage from "~/assets/images/changelog/hero.svg";
89
910
type Props = z.input<typeof props>;
@@ -34,15 +35,15 @@ const products = await uniqueProducts(notes);
3435
>
3536
<div class="text-center sm:text-left">
3637
<h1>Changelog</h1>
38+
<p>New updates and improvements at Cloudflare.</p>
3739
<p>
38-
New updates and improvements at Cloudflare.
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>
40+
<RSSButton changelog="index" />
41+
<br />
42+
<RSSButton
43+
href="/fundamentals/new-features/available-rss-feeds/"
44+
text="View all RSS feeds"
45+
icon="right-caret"
46+
/>
4647
</p>
4748
{
4849
products.length > 0 && (
@@ -75,4 +76,16 @@ const products = await uniqueProducts(notes);
7576
padding-top: 0 !important;
7677
overflow-x: hidden;
7778
}
79+
80+
.changelog-rss-links {
81+
display: flex;
82+
justify-content: space-between;
83+
margin-top: 0.25em !important;
84+
}
85+
86+
@media (max-width: 640px) {
87+
.changelog-rss-links {
88+
flex-direction: column;
89+
}
90+
}
7891
</style>

0 commit comments

Comments
 (0)