An open source design system that's fully customizable and agent ready
TypeScript
chore(sandbox): a raw page with every built-in Text type (#10636)
Christopher Chedeau5ebc81ba1ec9
diff --git a/apps/sandbox/scripts/next-export-routes.json b/apps/sandbox/scripts/next-export-routes.jsonindex 86b592d476..a8188d01c1 100644--- a/apps/sandbox/scripts/next-export-routes.json+++ b/apps/sandbox/scripts/next-export-routes.json@@ -54,6 +54,7 @@"/pages/table-lab/","/pages/table-overview/","/pages/tap-targets/",+ "/pages/text-types/","/pages/textarea-counter/","/pages/theme-family/","/pages/topnav-menu/",diff --git a/apps/sandbox/src/app/(raw)/pages/text-types/page.tsx b/apps/sandbox/src/app/(raw)/pages/text-types/page.tsxnew file mode 100644index 0000000000..d2802e9a62--- /dev/null+++ b/apps/sandbox/src/app/(raw)/pages/text-types/page.tsx@@ -0,0 +1,43 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file page.tsx+ * @input None+ * @output Every built-in Text type at the default size, one sample per row+ * @position A raw Sandbox page (/pages/text-types/) with no sandbox frame.+ * The document scrolls, so the browser's own text size reaches each type.+ */++import {VStack} from '@astryxdesign/core/Layout';+import {Text} from '@astryxdesign/core/Text';+import type {BuiltinTextType} from '@astryxdesign/core/theme';++// The record holds every built-in type.+// The typecheck fails when one is missing.+const SHOWN_TYPES: Record<BuiltinTextType, true> = {+ 'display-1': true,+ 'display-2': true,+ 'display-3': true,+ large: true,+ body: true,+ label: true,+ supporting: true,+ code: true,+ inherit: true,+};++const TEXT_TYPES = Object.keys(SHOWN_TYPES) as BuiltinTextType[];++const SAMPLE = 'The quick brown fox jumps over the lazy dog';++export default function TextTypesPage() {+ return (+ <VStack gap={4} padding={4}>+ {TEXT_TYPES.map(type => (+ <Text key={type} type={type}>+ {`${type}: ${SAMPLE}`}+ </Text>+ ))}+ </VStack>+ );+}diff --git a/apps/sandbox/src/app/sandboxPages.ts b/apps/sandbox/src/app/sandboxPages.tsindex 830fcff70d..a214265228 100644--- a/apps/sandbox/src/app/sandboxPages.ts+++ b/apps/sandbox/src/app/sandboxPages.ts@@ -152,6 +152,12 @@ export const categories: SandboxCategory[] = [description:'WCAG 2.5.8 AA touch-target sizes visualized on real components',},+ {+ name: 'Text Types',+ href: '/pages/text-types/',+ description:+ 'Every built-in Text type at the default size, on a bare page that scrolls',+ },],},{diff --git a/apps/sandbox/src/route-manifest.test.ts b/apps/sandbox/src/route-manifest.test.tsindex 22c9fd2f44..54b454cb51 100644--- a/apps/sandbox/src/route-manifest.test.ts+++ b/apps/sandbox/src/route-manifest.test.ts@@ -80,6 +80,9 @@ describe('Sandbox static export contract', () => {expect(routes.find(item => item.route === '/pages/mobile-prototypes/'),).toMatchObject({group: 'raw'});+ expect(+ routes.find(item => item.route === '/pages/text-types/'),+ ).toMatchObject({group: 'raw'});expect(routes.find(item => item.route === '/templates/work-item-detail/'),).toMatchObject({group: 'fullscreen'});