-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Astro] Public stats component (#16803)
* [Astro] Public stats component * Update slightly * Add style guide page
- Loading branch information
Showing
4 changed files
with
106 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
import { z } from "astro:content"; | ||
import { zodEnumFromObjKeys } from "~/util/helpers"; | ||
type Props = z.infer<typeof props>; | ||
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<string, string>; | ||
const props = z.object({ | ||
id: zodEnumFromObjKeys(mappings), | ||
}); | ||
// @ts-ignore | ||
const { id } = props.parse(Astro.props); | ||
let stat = mappings[id]; | ||
--- | ||
|
||
{stat} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <PublicStats id="data_center_cities" />. | ||
|
||
Our network has <PublicStats id="total_bandwidth" />. | ||
|
||
Cloudflare also has <PublicStats id="network_peers" />. | ||
``` | ||
|
||
:::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) | ||
|
||
::: |