Skip to content

Conversation

@hturan
Copy link
Contributor

@hturan hturan commented Nov 12, 2024

Summary

This PR gives a visual and functional refresh to the Products page (https://developers.cloudflare.com/products), including iconography, product descriptions, and the ability to search.

Screenshots (optional)

Screenshot 2024-11-12 at 15 43 53
Screenshot 2024-11-12 at 15 44 02
Screenshot 2024-11-12 at 15 44 16
Screenshot 2024-11-12 at 15 45 29
Screenshot 2024-11-12 at 18 31 27

Documentation checklist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of room for us to de-dupe this and ModelCatalog in the future. Left it be for now until we tackle a third instance of this pattern.

import { getCollection, type CollectionEntry } from "astro:content";
import { ThreeCardGrid, LinkCard } from "~/components";
// @ts-ignore virtual module
import iconCollection from "virtual:astro-icon";
Copy link
Contributor Author

@hturan hturan Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got 90% of the way through this work and then realised we have no good way to render icon / SVGs in react, and astro-icon does some interesting integration/optmimization under the hood. This code here replicates a little of what the Icon component does (https://github.com/natemoo-re/astro-icon/blob/531db17ec5367e22df7958d8f7abdeb880d8342b/packages/core/components/Icon.astro#L92) but just passes optimised SVG path data (as a string) through to React to render.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally had this in the jsx component, but due to how Astro works it was trying to import node modules into the client-side and breaking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried directly importing the icons (using import URLs), but you can't style SVG when used as an img src.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 12, 2024

Deploying cloudflare-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0dfacf2
Status: ✅  Deploy successful!
Preview URL: https://b2649889.cloudflare-docs-7ou.pages.dev
Branch Preview URL: https://hturan-products-directory.cloudflare-docs-7ou.pages.dev

View logs

Copy link
Member

@KianNH KianNH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, the styling is perfect! This looks great.

I found a few small issues which are hopefully quick fixes.

@hturan hturan requested a review from KianNH November 21, 2024 13:36
Copy link
Member

@KianNH KianNH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@KianNH KianNH merged commit 3eeeedb into production Nov 21, 2024
11 checks passed
@KianNH KianNH deleted the hturan/products-directory branch November 21, 2024 14:29
harshil1712 pushed a commit that referenced this pull request Dec 3, 2024
* Update Products directory

* Fix changes to 1.1.1.1 icon

* Fixed client-side node imports

* Added dark colors

* Design tweaks for truncated product names

* Fix types, add category deep-links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants