Repository navigation
feat(sandbox): Mobile Type explorer tool page - #4883
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
rubyycheung
force-pushed
the
feat/mobile-type-explorer
branch
from
August 11, 2026 07:59
1dfff72 to
2889c2f
Compare
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Adds a fullscreen sandbox tool for exploring how the Astryx type scale
adapts on touch devices, mirroring the docsite playground theme editor.
- Desktop column is the fixed reference, computed with the same
geometric progression as expandTypeScale (round(base × ratio^step)),
matching the playground default (base 14, ratio 1.2).
- Mobile adaptation is a master switch with three strategies:
- Lift: floor body to the 16px readability minimum and rebuild the
whole ladder at the full desktop ratio, keeping the display tier
large and dramatic.
- Pin: hold an anchor role (H1 by default) at its desktop size and
re-derive a tamer ratio so headings do not balloon.
- Custom: hand-tune each role's mobile size.
- Real-component preview renders the same Astryx components at both
scales; the mobile side sits in a phone frame with the raw
--font-size-* tokens overridden, demonstrating the token-layer
mechanism a shipped implementation would use.
- 16px floor is explained inline: it matches the existing input
behavior under @media (pointer: coarse).
rubyycheung
force-pushed
the
feat/mobile-type-explorer
branch
from
August 11, 2026 08:06
2889c2f to
449fa0a
Compare
The real-component preview didn't change with scale/lift/pin/custom adjustments. Components read the semantic type-scale tokens (--text-body-size, --text-display-3-size, …), which the base theme defines as var(--font-size-*) refs on :root. The browser resolves those refs at :root, so overriding the raw --font-size-* tokens on a wrapper had no effect — the semantic token had already captured root's value. Override the semantic --text-*-size (and -leading) tokens directly, as literal rem values, on each preview side. This is the token layer real components actually read, so they now render at the adapted scale. Verified against the built stylesheet: desktop reads 29/24/14px for display-3/heading-1/body, mobile reads 33/28/16px.
Add a live formula caption to the Mobile column that explains how each adaptation mode derives its sizes, with the current numbers substituted: - Lift: size = round(16 × ratio^step) - Pin: ratioₚ = ratio × (base/bottom)^(1/pinStep); size = round(16 × ratioₚ^step) It reacts to scale, mode, and anchor changes so the math is self-explanatory.
…o preview - Show the derivation as plain text beside the Mobile column heading, with 'Base floored 14 → 16px' leading the note line. Updates live per mode. - Add a Display 1 sample to the real-component preview so the very top of the scale is visible when the anchor/mode changes.
rubyycheung
marked this pull request as ready for review
August 11, 2026 16:18
… anchors - HStack vAlign only accepts center/start/end/stretch; 'baseline' broke the sandbox type-check build. Use 'center'. - Add Display 1 and Display 2 to the Pin anchor list now that Display 1 is in the preview.
The gray preview background only wrapped its content, leaving white to the right and below. Make the pane fill the scroll area (height 100% + overflow-y auto) and wrap the content in a centered max-width container.
… width The Astryx Layout root is flex:0 1 auto, so inside the fixed-position page wrapper it collapsed to content width and left a white gap on wide screens. Pass xstyle flex:1/width:100% so it fills, letting the muted preview pane span the full remaining width with content centered inside it.
Gentle scales pin high; dramatic scales need a lower anchor so the display tier doesn't tower over 16px body on a phone. Map ratio → recommended anchor: - ≤ Major Third (1.25): Display 1 - Perfect Fourth (1.333): Heading 2 - Aug Fourth and above (≥ 1.414): Heading 3 Show a 'Recommended' badge on that option in the dropdown, plus an inline hint with a 'Use' button so it's visible without opening the menu.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a fullscreen Mobile Type sandbox tool for exploring how the Astryx type scale adapts on touch devices. Styled to match the docsite playground theme editor (Layout/LayoutPanel, SegmentedControl, unprefixed
@astryxdesign/corecomponents).This is an exploration tool for the mobile web typography strategy — it does not change any shipped tokens or component behavior. Desktop output is byte-identical.
What it shows
Desktop column is the fixed reference, computed with the exact same geometric progression as
expandTypeScale(round(base × ratio^step)) and seeded from the playground default (base 14, ratio 1.2). Verified to match the realexpandTypeScaleoutput role-for-role.Mobile adaptation is a master switch with three strategies:
Recommended pin anchor (scale-aware)
When Pin is selected, the tool recommends an anchor based on the current desktop ratio and surfaces it two ways: a Recommended badge on that option in the dropdown, and an inline hint with a Use button (visible without opening the menu). The recommendation auto-hides once the selected anchor matches it.
The rationale: gentle scales can pin high because the whole ladder is already close together (pinning Display 1 barely tames anything), while dramatic scales need a lower anchor so the display tier doesn't tower over 16px body text on a phone.
This is a starting recommendation, not a lock — any anchor stays selectable.
Real-component preview renders the same set of Astryx components (Heading, Text, Badge, Avatar, Button, Divider, Code) at both scales. The mobile side sits in a phone frame with the raw
--font-size-*tokens overridden — a live demonstration of the token-layer mechanism a shipped implementation would use (semantic tokens arevar()refs to the raw scale, so overriding the raw tokens cascades into every component with zero per-component change).Why 16px
The 16px floor is explained inline in the tool: it matches the existing input behavior, where 8 Astryx input components already bump to 16px under
@media (pointer: coarse)to stop mobile browsers auto-zooming on focus. Flooring body to match keeps text and inputs on the same scale.Files
apps/sandbox/src/app/(sandbox)/pages/mobile-type/page.tsx— new tool pageapps/sandbox/src/app/SandboxShell.tsx— register/pages/mobile-typeas fullscreenapps/sandbox/src/app/sandboxPages.ts— add page under ToolsChecks
Typecheck, ESLint, and all pre-commit repo checks (sync, package-boundaries, changesets, demo-media, executable-bits, cli-structure) pass. Page renders 200. All three modes verified with screenshots.
Status
Exploration tool for review. Follow-ups (separate PRs): proposal doc, then the actual
expandTypeScale+generateThemeRuleschange to emit a@media (pointer: coarse)block, and the sub-44px touch-target floor.