diff --git a/src/components/PublicStats.astro b/src/components/PublicStats.astro new file mode 100644 index 00000000000000..c6ee1837c267c1 --- /dev/null +++ b/src/components/PublicStats.astro @@ -0,0 +1,23 @@ +--- +import { z } from "astro:content"; +import { zodEnumFromObjKeys } from "~/util/helpers"; + +type Props = z.infer; + +const mappings = { + data_center_cities: "over 330 cities", + total_bandwidth: "over 296 Tbps network capacity", + network_peers: "over 12,500 network peers", +} as const satisfies Record; + +const props = z.object({ + id: zodEnumFromObjKeys(mappings), +}); + +// @ts-ignore +const { id } = props.parse(Astro.props); + +let stat = mappings[id]; +--- + +{stat} diff --git a/src/components/index.ts b/src/components/index.ts index a46b9cf4273e72..fd6987b1d7ca01 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,64 +1,65 @@ // Starlight built-ins -export * from "@astrojs/starlight/components" -export { Icon as StarlightIcon } from "@astrojs/starlight/components" +export * from "@astrojs/starlight/components"; +export { Icon as StarlightIcon } from "@astrojs/starlight/components"; // Community packages -export { PackageManagers } from 'starlight-package-managers' -export { Icon as AstroIcon } from 'astro-icon/components' +export { PackageManagers } from "starlight-package-managers"; +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 CompatibilityDates } from "./CompatibilityDates.astro" -export { default as Description } from "./Description.astro" -export { default as Details } from "./Details.astro" -export { default as DirectoryListing } from "./DirectoryListing.astro" -export { default as Example } from "./Example.astro" -export { default as ExternalResources } from "./ExternalResources.astro" -export { default as Feature } from "./Feature.astro" -export { default as FeatureTable } from "./FeatureTable.astro" -export { default as Glossary } from "./Glossary.astro" -export { default as GlossaryDefinition } from "./GlossaryDefinition.astro" -export { default as GlossaryTooltip } from "./GlossaryTooltip.astro" -export { default as HomepageHero } from "./HomepageHero.astro" -export { default as InlineBadge } from "./InlineBadge.astro" -export { default as LastReviewed } from "./LastReviewed.astro" -export { default as LearningPath } from "./LearningPath.astro" -export { default as LinkTitleCard } from "./LinkTitleCard.astro" -export { default as ListExamples } from "./ListExamples.astro" -export { default as ListTutorials } from "./ListTutorials.astro" -export { default as Markdown } from "./Markdown.astro" -export { default as NetworkMap } from "./NetworkMap.astro" -export { default as PagesBuildEnvironment } from "./PagesBuildEnvironment.astro" -export { default as PagesBuildEnvironmentLanguages } from "./PagesBuildEnvironmentLanguages.astro" -export { default as PagesBuildEnvironmentTools } from "./PagesBuildEnvironmentTools.astro" -export { default as PagesBuildPreset } from "./PagesBuildPreset.astro" -export { default as PagesBuildPresetsTable } from "./PagesBuildPresetsTable.astro" -export { default as PagesLanguageSupport } from "./PagesLanguageSupport.astro" -export { default as Plan } from "./Plan.astro" -export { default as PlanInfo } from "./PlanInfo.astro" -export { default as ProductChangelog } from "./ProductChangelog.astro" -export { default as ProductFeatures } from "./ProductFeatures.astro" -export { default as ProductsByTag } from "./ProductsByTag.astro" -export { default as RelatedProduct } from "./RelatedProduct.astro" -export { default as Render } from "./Render.astro" -export { default as ResourcesBySelector } from "./ResourcesBySelector.astro" -export { default as RuleID } from "./RuleID.astro" -export { default as SpotlightAuthorDetails } from "./SpotlightAuthorDetails.astro" -export { default as Stream } from "./Stream.astro" -export { default as ThreeCardGrid } from "./ThreeCardGrid.astro" -export { default as TroubleshootingList } from "./TroubleshootingList.astro" -export { default as TunnelCalculator } from "./TunnelCalculator.astro" -export { default as WorkersAIModels } from "./WorkersAIModels.astro" -export { default as WorkersArchitectureDiagram } from "./WorkersArchitectureDiagram.astro" -export { default as WorkersIsolateDiagram } from "./WorkersIsolateDiagram.astro" -export { default as WorkerStarter } from "./WorkerStarter.astro" -export { default as YouTube } from "./YouTube.astro" +export { default as AnchorHeading } from "./AnchorHeading.astro"; +export { default as AvailableNotifications } from "./AvailableNotifications.astro"; +export { default as CompatibilityDates } from "./CompatibilityDates.astro"; +export { default as Description } from "./Description.astro"; +export { default as Details } from "./Details.astro"; +export { default as DirectoryListing } from "./DirectoryListing.astro"; +export { default as Example } from "./Example.astro"; +export { default as ExternalResources } from "./ExternalResources.astro"; +export { default as Feature } from "./Feature.astro"; +export { default as FeatureTable } from "./FeatureTable.astro"; +export { default as Glossary } from "./Glossary.astro"; +export { default as GlossaryDefinition } from "./GlossaryDefinition.astro"; +export { default as GlossaryTooltip } from "./GlossaryTooltip.astro"; +export { default as HomepageHero } from "./HomepageHero.astro"; +export { default as InlineBadge } from "./InlineBadge.astro"; +export { default as LastReviewed } from "./LastReviewed.astro"; +export { default as LearningPath } from "./LearningPath.astro"; +export { default as LinkTitleCard } from "./LinkTitleCard.astro"; +export { default as ListExamples } from "./ListExamples.astro"; +export { default as ListTutorials } from "./ListTutorials.astro"; +export { default as Markdown } from "./Markdown.astro"; +export { default as NetworkMap } from "./NetworkMap.astro"; +export { default as PagesBuildEnvironment } from "./PagesBuildEnvironment.astro"; +export { default as PagesBuildEnvironmentLanguages } from "./PagesBuildEnvironmentLanguages.astro"; +export { default as PagesBuildEnvironmentTools } from "./PagesBuildEnvironmentTools.astro"; +export { default as PagesBuildPreset } from "./PagesBuildPreset.astro"; +export { default as PagesBuildPresetsTable } from "./PagesBuildPresetsTable.astro"; +export { default as PagesLanguageSupport } from "./PagesLanguageSupport.astro"; +export { default as Plan } from "./Plan.astro"; +export { default as PlanInfo } from "./PlanInfo.astro"; +export { default as ProductChangelog } from "./ProductChangelog.astro"; +export { default as ProductFeatures } from "./ProductFeatures.astro"; +export { default as ProductsByTag } from "./ProductsByTag.astro"; +export { default as PublicStats } from "./PublicStats.astro"; +export { default as RelatedProduct } from "./RelatedProduct.astro"; +export { default as Render } from "./Render.astro"; +export { default as ResourcesBySelector } from "./ResourcesBySelector.astro"; +export { default as RuleID } from "./RuleID.astro"; +export { default as SpotlightAuthorDetails } from "./SpotlightAuthorDetails.astro"; +export { default as Stream } from "./Stream.astro"; +export { default as ThreeCardGrid } from "./ThreeCardGrid.astro"; +export { default as TroubleshootingList } from "./TroubleshootingList.astro"; +export { default as TunnelCalculator } from "./TunnelCalculator.astro"; +export { default as WorkersAIModels } from "./WorkersAIModels.astro"; +export { default as WorkersArchitectureDiagram } from "./WorkersArchitectureDiagram.astro"; +export { default as WorkersIsolateDiagram } from "./WorkersIsolateDiagram.astro"; +export { default as WorkerStarter } from "./WorkerStarter.astro"; +export { default as YouTube } from "./YouTube.astro"; // Taken from Astro -export { default as ListCard } from "./astro/ListCard.astro" -export { default as FourCardGrid } from "./FourCardGrid.astro" +export { default as ListCard } from "./astro/ListCard.astro"; +export { default as FourCardGrid } from "./FourCardGrid.astro"; // Homepage -export { default as FeaturedContentSection } from "./homepage/FeaturedContentSection.astro" -export { default as FooterHeroBlock } from "./homepage/FooterHeroBlock.astro" -export { default as RecommendedContentSection } from "./homepage/RecommendedContentSection.astro" -export { default as TryItSection } from "./homepage/TryItSection.astro" \ No newline at end of file +export { default as FeaturedContentSection } from "./homepage/FeaturedContentSection.astro"; +export { default as FooterHeroBlock } from "./homepage/FooterHeroBlock.astro"; +export { default as RecommendedContentSection } from "./homepage/RecommendedContentSection.astro"; +export { default as TryItSection } from "./homepage/TryItSection.astro"; diff --git a/src/content/docs/1.1.1.1/check.mdx b/src/content/docs/1.1.1.1/check.mdx index f323111ff70010..e6ca8f6d58b88d 100644 --- a/src/content/docs/1.1.1.1/check.mdx +++ b/src/content/docs/1.1.1.1/check.mdx @@ -4,9 +4,10 @@ title: Verify connection sidebar: order: 6 slug: 1.1.1.1/check - --- +import { PublicStats } from "~/components"; + After setting up `1.1.1.1`, you can check if you are correctly connected to Cloudflare's resolver. 1. Open a web browser on a configured device (smartphone or computer) or on a device connected to your configured router. diff --git a/src/content/docs/style-guide/components/public-stats.mdx b/src/content/docs/style-guide/components/public-stats.mdx new file mode 100644 index 00000000000000..7f4eb36331314a --- /dev/null +++ b/src/content/docs/style-guide/components/public-stats.mdx @@ -0,0 +1,23 @@ +--- +title: Public stats +--- + +The `PublicStats` component allows you to reference specific values about Cloudflare's network without maintaining those values in multiple files. + +Refer to the examples below for more information. + +```mdx live +import { PublicStats } from "~/components"; + +Cloudflare has data centers in . + +Our network has . + +Cloudflare also has . +``` + +:::note + +If you need more stats or to update these stats, submit a pull request to update [PublicStats.astro](https://github.com/cloudflare/cloudflare-docs/blob/production/src/components/PublicStats.astro) + +:::