diff --git a/src/components/CompatibilityFlag.astro b/src/components/CompatibilityFlag.astro new file mode 100644 index 000000000000000..dc80b2878c5230a --- /dev/null +++ b/src/components/CompatibilityFlag.astro @@ -0,0 +1,32 @@ +--- +import { Aside } from "@astrojs/starlight/components"; +import { reference, getEntry } from "astro:content"; +import { z } from "astro:schema"; + +const props = z.object({ + flag: reference("compatibility-flags"), +}); + +const { flag } = await props.parseAsync(Astro.props); + +const { data } = await getEntry("compatibility-flags", flag.slug); + +const { enable_flag, enable_date } = data; +--- + + diff --git a/src/components/index.ts b/src/components/index.ts index a52dbcbc622eac5..2e85b1a6cba5511 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -7,6 +7,7 @@ export { Icon as AstroIcon } from "astro-icon/components"; // Custom components export { default as AnchorHeading } from "./AnchorHeading.astro"; export { default as AvailableNotifications } from "./AvailableNotifications.astro"; +export { default as CompatibilityFlag } from "./CompatibilityFlag.astro"; export { default as CompatibilityFlags } from "./CompatibilityFlags.astro"; export { default as Description } from "./Description.astro"; export { default as Details } from "./Details.astro"; diff --git a/src/content/docs/style-guide/components/compatibility-flag.mdx b/src/content/docs/style-guide/components/compatibility-flag.mdx new file mode 100644 index 000000000000000..ae0716693dd3f97 --- /dev/null +++ b/src/content/docs/style-guide/components/compatibility-flag.mdx @@ -0,0 +1,17 @@ +--- +title: Compatibility flag +--- + +This component will create an aside with the `enable_date` (if present) and the `enable_flag` of a given flag. + +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. + +## Component + +```mdx live +import { CompatibilityFlag } from "~/components"; + + + + +```