Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression15 of 420 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
This change adds a useful CSS-only hideBelow option to LayoutPanel, with documentation, a story, and tests, and existing callers are unchanged when the prop is omitted.
Approval is waiting on a maintainer decision: please provide or identify the governing spec for this addition. That spec needs to settle the hideBelow name (and whether symmetric options are needed), the breakpoint token set and its owner — including the new xl value and whether the values become a shared system token — the inclusive boundary meaning of "below", and the mounted-subtree behavior (including how an adjacent resize handle is handled when a panel hides).
No concrete code defect was found in this review; the hold is only about establishing that public contract before it is released.
[Automated review]
e1a040b to
32b6dba
Compare
|
Rebased onto current @cixzhang Please review the updated head and settle the proposed public contract: The formal review-request API rejects my account's permissions in this repository, so this comment is the re-review/maintainer-decision request; existing reviewer assignments are retained. |
There was a problem hiding this comment.
Approval is waiting on a maintainer decision: a maintainer needs to provide or identify the governing spec for responsive hiding on LayoutPanel, settling whether LayoutPanel should own it at all and, if so, how a hidden but still-mounted panel interacts with Layout's spacing and an adjacent ResizeHandle. If the addition is accepted, these also need to change before approval:
- Use the five shared width-point names, including
2xl, resolved from the active theme asAppShelldoes, instead of a local 640/768/1024/1280 table. - Treat "below" as exclusive (
width < N) so the panel stays visible at exactly the named width, and update the docs, story text and tests to match. - Keep
LayoutContent's padding correct when a panel is hidden; today it keeps the inner inset at the edge the panel vacated, which shows whenLayouthaspadding={0}. - Do not leave an adjacent
ResizeHandlefocusable and operable for a hidden panel, or stop documentingresizablewithhideBelowas a supported combination.
[Automated review]
Fixes #3339
Refs #4476
Summary
Adds
hideBelow?: 'sm' | 'md' | 'lg' | 'xl'toLayoutPanel, implementing the spec from #3339: the panel hides itself below the given viewport-width breakpoint with a compile-time CSS@media (max-width: ...) { display: none }toggle in StyleX. NouseMediaQuery, no runtime measurement, no hydration flash: the panel stays mounted and server-rendered HTML matches the client.How breakpoints are consumed in StyleX
StyleX cannot read
var()inside at-rule conditions, so the media queries must be compile-time values. I followed the existing repo precedent (FormLayout'sHORIZONTAL_LABELS_COLLAPSE = '@media (max-width: 480px)'literal used as a condition key) rather than introducing a newstylex.defineConsts()token file, since there is nodefineConstsprecedent in the repo yet and Phase 9 of the issue leaves the breakpoint token set pending sign-off.Values align with
AppShell'sBREAKPOINT_VALUES(sm: 640, md: 768, lg: 1024) plus anxl: 1280step, and match the exactmax-widthqueries the templates hand-rolled ((max-width: 768px)=md,(max-width: 1024px)=lg), so template migration is a drop-in replacement.Changes
packages/core/src/Layout/LayoutPanel.tsx:hideBelowprop, fourhideBelowStylesmedia-query display toggles, wired intostylex.propsbeforexstyleso consumers can still override.packages/core/src/Layout/LayoutPanel.doc.mjs: prop documented indocs,docsZh, anddocsDense(inlined literal union per the docPropLiterals guard).packages/core/src/Layout/__tests__/hideBelow.test.tsx: per-breakpoint assertions that the injected CSS rule for the panel's class is adisplay: nonetoggle under exactly that breakpoint'smax-widthquery; default (no prop) emits no hide class; distinct classes per breakpoint; composition withwidth/hasDivider; SSR test thatrenderToStringmarkup contains the mounted panel and its class list matches the client render.apps/storybook/stories/Layout.stories.tsx:Responsive Hidden Panelsstory mirroring the messaging-shell case (start panelhideBelow="md", end panelhideBelow="lg")..changeset/layoutpanel-hidebelow.md:[feat]patch for@astryxdesign/core.Explicitly out of scope (follow-up after merge)
Template adoption is deliberately not included: the four hand-rolled
useMediaQuerypanel-hide sites in incident-console (#3316), messaging-shell (#3323), and deployment-detail (#3330) will be migrated tohideBelowin a follow-up once this API lands, per the issue's migration use case.Open questions (Phase 8/9 arbitration, flagged for sign-off)
hideBelowper the issue title (Chakra-aligned). ShouldhideFrom/showBelowland alongside it for symmetry, or wait for demand?sm/md/lgreuse AppShell's values;xl: 1280is new (Tailwind-aligned). Is this the blessed system-wide set, and should it graduate to a sharedbreakpoints.stylex.tsviastylex.defineConsts()that AppShell/FormLayout also consume? Happy to do that here or as a follow-up.<=the breakpoint value (max-width: Npx), matching AppShell's collapse behavior and the templates' existing queries. If "below" should mean strictly< N, the queries can switch tomax-width: (N - 0.02)px.Verification
pnpm exec vitest run packages/core/src/Layoutplus the doc guards (docPropLiterals,docPropReferences): 111 tests pass, including the 9 newhideBelowtests.@astryxdesign/coreui suite: 234 files, 5721 tests pass.tsc --noEmitclean forpackages/core(src + docs project) andapps/storybook.check:sync,check:changesets,check:package-boundaries, eslint (pre-commit hooks): clean.pnpm -F @astryxdesign/core buildsucceeds;dist/astryx.csscontains all four generated rules, e.g.@media (max-width: 1024px){....{display:none}}.astryx component LayoutPanel --densenow listshideBelowwith breakpoint values.