File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed
content/docs/style-guide/components Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ import { Aside } from " @astrojs/starlight/components" ;
3+ import { reference , getEntry } from " astro:content" ;
4+ import { z } from " astro:schema" ;
5+
6+ const props = z .object ({
7+ flag: reference (" compatibility-flags" ),
8+ });
9+
10+ const { flag } = await props .parseAsync (Astro .props );
11+
12+ const { data } = await getEntry (" compatibility-flags" , flag .slug );
13+
14+ const { enable_flag, enable_date } = data ;
15+ ---
16+
17+ <Aside >
18+ To use this feature,
19+ {
20+ enable_date && (
21+ <span >
22+ <a href = " /workers/configuration/compatibility-dates/" >
23+ define a compatibility date
24+ </a >{ " " }
25+ of <code >{ enable_date } </code > or higher, or
26+ </span >
27+ )
28+ } include <code >{ enable_flag } </code > in your <a
29+ href ={ ` /workers/configuration/compatibility-flags/#setting-compatibility-flags ` }
30+ >compatibility flags</a
31+ >.
32+ </Aside >
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export { Icon as AstroIcon } from "astro-icon/components";
77// Custom components
88export { default as AnchorHeading } from "./AnchorHeading.astro" ;
99export { default as AvailableNotifications } from "./AvailableNotifications.astro" ;
10+ export { default as CompatibilityFlag } from "./CompatibilityFlag.astro" ;
1011export { default as CompatibilityFlags } from "./CompatibilityFlags.astro" ;
1112export { default as Description } from "./Description.astro" ;
1213export { default as Details } from "./Details.astro" ;
Original file line number Diff line number Diff line change 1+ ---
2+ title : Compatibility flag
3+ ---
4+
5+ This component will create an aside with the ` enable_date ` (if present) and the ` enable_flag ` of a given flag.
6+
7+ The flag must match the name of a file in the [ ` compatibility-flags ` collection] ( https://github.com/cloudflare/cloudflare-docs/tree/production/src/content/compatibility-flags ) , without the file extension.
8+
9+ ## Component
10+
11+ ``` mdx live
12+ import { CompatibilityFlag } from " ~/components" ;
13+
14+ <CompatibilityFlag flag = " global-navigator" />
15+
16+ <CompatibilityFlag flag = " nodejs-compat" />
17+ ```
You can’t perform that action at this time.
0 commit comments