mirror of
https://github.com/cloudflare/cloudflare-docs.git
synced 2026-01-11 20:06:58 +00:00
* [Docs Site] Adopt eslint * Demonstrate a fixable suggestion, add VSCode plugin and package.json script * Fix slice in ModelCatalog * Remove test error in AnchorHeading * recreate package-lock.json * update new .jsx components to .tsx * amend deps, fix react types, organise ec plugins * another attempt at fixing platform-specific deps * fix FieldCatalog filters, remove test block from code.mdx * use opacity instead of brightness for ruleid * fix lockfile * amend ruleid opacity styling * test onetrust * enable prefer const rule, remove onetrust test * add save-dev
54 lines
1.4 KiB
Text
54 lines
1.4 KiB
Text
---
|
|
import { getCollection, type CollectionEntry } from "astro:content";
|
|
// @ts-expect-error virtual module
|
|
import iconCollection from "virtual:astro-icon";
|
|
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
|
|
import { getIconData, iconToSVG } from "@iconify/utils";
|
|
import ProductCatalog from "~/components/ProductCatalog";
|
|
import type { ProductData } from "~/components/ProductCatalog";
|
|
import type { StarlightPageProps } from "@astrojs/starlight/props";
|
|
|
|
let products: CollectionEntry<"products">[] = await getCollection(
|
|
"products",
|
|
(entry: CollectionEntry<"products">) => {
|
|
return entry.data.product?.show ?? true;
|
|
},
|
|
);
|
|
|
|
let productData: ProductData[] = products.map((product) => {
|
|
const iconData = getIconData(iconCollection.local, product.id);
|
|
let icon = undefined;
|
|
if (iconData) {
|
|
icon = iconToSVG(iconData);
|
|
}
|
|
|
|
return {
|
|
...product,
|
|
icon,
|
|
groups: [
|
|
product.data.product.group,
|
|
...(product.data.product.additional_groups || []),
|
|
].filter((val) => Boolean(val)),
|
|
};
|
|
});
|
|
|
|
const props = {
|
|
frontmatter: {
|
|
title: "Products",
|
|
description:
|
|
"API reference, how-to guides, tutorials, example code, and more.",
|
|
template: "splash",
|
|
},
|
|
hideBreadcrumbs: true,
|
|
} as StarlightPageProps;
|
|
---
|
|
|
|
<StarlightPage {...props}>
|
|
<ProductCatalog products={productData} client:load />
|
|
</StarlightPage>
|
|
|
|
<style>
|
|
html:not([data-has-sidebar]) {
|
|
--sl-content-width: 75rem;
|
|
}
|
|
</style>
|