Skip to content

Commit d3e87b9

Browse files
KianNHelithrar
authored andcommitted
[Docs Site] Fix ExternalResources cloudflareOnly prop (#17367)
* [Docs Site] Fix ExternalResources cloudflareOnly prop * Apply suggestions from code review
1 parent 5dd0e56 commit d3e87b9

File tree

2 files changed

+46
-6
lines changed

2 files changed

+46
-6
lines changed

src/components/ExternalResources.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ const props = z.object({
88
type: z.enum(["apps", "videos"]),
99
tags: z.string().array().optional(),
1010
products: z.string().array().optional(),
11-
cloudflare: z.boolean().default(true),
11+
cloudflareOnly: z.boolean().default(true),
1212
});
1313
14-
const { type, tags, products, cloudflare } = props.parse(Astro.props);
14+
const { type, tags, products, cloudflareOnly } = props.parse(Astro.props);
1515
1616
const resources = await getEntry(type, "index");
1717
1818
const filtered = resources.data.entries.filter((entry) => {
1919
return (
20-
(cloudflare ? entry.cloudflare : false) &&
20+
(cloudflareOnly ? entry.cloudflare : true) &&
2121
(tags ? entry.tags?.some((v: string) => tags.includes(v)) : true) &&
2222
(products
2323
? entry.products?.some((v: string) => products.includes(v))
@@ -35,8 +35,8 @@ filtered.sort((a, b) => Number(b.updated) - Number(a.updated));
3535
return (
3636
<li>
3737
<>
38-
<a href={entry.link}>{title}</a>
39-
<span>: {entry.description}</span>
38+
<a href={entry.link}>{title}:</a>
39+
<span>{entry.description}</span>
4040
</>
4141
</li>
4242
);

src/content/docs/style-guide/components/external-resources.mdx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
title: External resources
33
---
44

5+
The `ExternalResources` component pulls from a central list of [apps](https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/apps/index.yaml) and [videos](https://github.com/cloudflare/cloudflare-docs/blob/production/src/content/videos/index.yaml).
6+
7+
## Import
8+
9+
```mdx
10+
import { ExternalResources } from "~/components";
11+
```
12+
13+
## Preview
14+
515
```mdx live
616
import { ExternalResources } from "~/components";
717

@@ -10,4 +20,34 @@ import { ExternalResources } from "~/components";
1020

1121
## Videos
1222
<ExternalResources type="videos" tags={["AI"]} />
13-
```
23+
```
24+
25+
## Props
26+
27+
### `type`
28+
29+
**required**
30+
31+
**type:** `"apps" | "videos"`
32+
33+
The type of resources to show, apps or videos.
34+
35+
### `tags`
36+
37+
**type:** `string[]`
38+
39+
Filter resources down to those where the `tags` property contains any of these strings.
40+
41+
### `products`
42+
43+
**type:** `string[]`
44+
45+
Filter resources down to those where the `products` property contains any of these strings.
46+
47+
### `cloudflareOnly`
48+
49+
**type:** `boolean`
50+
51+
**default:** `true`
52+
53+
Filter resources down to those with `cloudflare: true`.

0 commit comments

Comments
 (0)