From 6e35c579bbb2221239d21d0aa90a9f6c840d345f Mon Sep 17 00:00:00 2001 From: KianNH Date: Sun, 2 Feb 2025 12:11:28 +0000 Subject: [PATCH 1/2] [Docs Site] changelog-next styling --- src/components/changelog-next/Header.astro | 101 +++++++------- .../changelog-next/ProductPills.astro | 2 +- src/pages/changelog-next/[...slug].astro | 66 +++------ src/pages/changelog-next/index.astro | 132 +++++++----------- src/pages/changelog-next/rss.xml.ts | 2 +- 5 files changed, 125 insertions(+), 178 deletions(-) diff --git a/src/components/changelog-next/Header.astro b/src/components/changelog-next/Header.astro index 84248467b9608fb..5c86cf72d9ea0fa 100644 --- a/src/components/changelog-next/Header.astro +++ b/src/components/changelog-next/Header.astro @@ -9,76 +9,71 @@ import HeroImage from "~/assets/images/changelog-next/hero.svg"; type Props = z.infer; const props = z.object({ - entries: z.array(z.any()).optional(), + notes: z.any().array().default([]), }); -const { entries } = props.parse(Astro.props); +const { notes } = props.parse(Astro.props); async function uniqueProducts( - entries?: Array>, + notes: Array>, ) { - const products = entries?.flatMap((entry) => entry.data.products ?? []); - const unique = [ - ...new Map(products?.map((product) => [product.id, product])).values(), + ...new Set(notes.flatMap((e) => e.data.products.map((p) => p.id))), ]; return Promise.all( unique.map(async (product) => { - return getEntry(product); + return getEntry("products", product)!; }), ); } -const products = await uniqueProducts(entries); +const products = await uniqueProducts(notes); ---
-
-
-
- hero image -
-

Changelog

-

- New updates and improvements at Cloudflare. - - - Subscribe to RSS - - - -

- { - entries && ( -
- -
- ) - } -
- +
+

Changelog

+

+ New updates and improvements at Cloudflare. + + Subscribe to RSS + + +

+ { + products.length > 0 && ( +
+ +
+ ) + }
+ hero image
+ + diff --git a/src/components/changelog-next/ProductPills.astro b/src/components/changelog-next/ProductPills.astro index 395457a400c8c21..bafe12f54720822 100644 --- a/src/components/changelog-next/ProductPills.astro +++ b/src/components/changelog-next/ProductPills.astro @@ -20,7 +20,7 @@ const data = await getEntries(products); { data.map((product) => ( - + )) } diff --git a/src/pages/changelog-next/[...slug].astro b/src/pages/changelog-next/[...slug].astro index b675039a70f1985..95cb62013ab36b0 100644 --- a/src/pages/changelog-next/[...slug].astro +++ b/src/pages/changelog-next/[...slug].astro @@ -40,61 +40,37 @@ const props = {
-
-
- - - Back to all posts - + +
+

{note.data.title}

+
+ {format(note.data.date, "MMM dd, yyyy")}, { + format(note.data.date, "hh:mm a") + } +
-
-

{note.data.title}

-
- {format(note.data.date, "MMM dd, yyyy")}, { - format(note.data.date, "hh:mm a") - } - -
-
- -
+
+
diff --git a/src/pages/changelog-next/index.astro b/src/pages/changelog-next/index.astro index 5b0f896d800dcf4..775421bc4652b05 100644 --- a/src/pages/changelog-next/index.astro +++ b/src/pages/changelog-next/index.astro @@ -26,53 +26,50 @@ const props = { --- -
-
- { - notes.map(async (entry) => { - const date = format(entry.data.date, "MMM dd, yyyy"); - const time = format(entry.data.date, "hh:mm a"); - const productIds = JSON.stringify( - entry.data.products.map((product) => product.id), - ); - - const { Content } = await render(entry); - - return ( - <> -
-

- {date} - {time} -

-
- -
    -
  1. -
    +
    + { + notes.map(async (entry) => { + const date = format(entry.data.date, "MMM dd, yyyy"); + const time = format(entry.data.date, "hh:mm a"); + const productIds = JSON.stringify( + entry.data.products.map((product) => product.id), + ); + + const { Content } = await render(entry); + + return ( +
    + + +
      +
    1. + -

      - -

      -
    2. -
    -
    - - ); - }) - } -
    + + +
    +

    + +

    +
  2. +
+
+
+ ); + }) + }