Skip to content

feat(templates): add Shell — Top Nav page template#3194

Closed
ernestt wants to merge 6 commits into
fix/mega-menu-anchor-collisionfrom
feat/shell-commerce-template
Closed

feat(templates): add Shell — Top Nav page template#3194
ernestt wants to merge 6 commits into
fix/mega-menu-anchor-collisionfrom
feat/shell-commerce-template

Conversation

@ernestt

@ernestt ernestt commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Top Nav example to the new Shell template category — a top-nav app shell with a fully built-out navigation and a static placeholder body.

  • AppShell (surface variant) as the root.
  • TopNav with two TopNavMegaMenus — Shop and Brands — each a fixed-width 2-column item grid plus a TopNavMegaMenuFeaturedCard, alongside Sale/Service items and search / sign-in / checkout actions.
  • Centered body of static grey Card placeholders (hero banner + repeated category-tile lockups) with whitespace gutters on wide screens.
  • Both mega menus are pinned to identical item/featured widths so switching between them produces zero layout shift.

Preview

Top Nav Shell template

(Default view; Shop and Brands open mega-menu panels on hover.)

⚠️ Depends on #3193. This template puts two TopNavMegaMenus in one nav, which requires the core anchor-name list fix so both menus can anchor to the shared <nav> without clobbering each other. This PR is based on the fix/mega-menu-anchor-collision branch — review/merge #3193 first, then this PR's base can retarget to main.

Test plan

  • Template auto-discovered by the sync script; renders in the sandbox and the docsite Shell tab (thumbnail + preview).
  • Shop and Brands panels open at the same offset and identical size; no flash/jump when hovering between them (verified in browser).
  • tsc passes; lint/format clean.

Template Rubric Score

Type: page · File: packages/cli/templates/pages/shell-top-nav/page.tsx · Grade: A (90/100)

Category Points Max Details
Astryx Component Purity 30 30 0 raw HTML elements — all JSX is Astryx (AppShell, TopNav*, Grid, Stack, Button, Badge, Card…) plus local MegaItems/MegaFeatured helpers.
Icon Purity 15 15 0 raw SVG. All icons via <Icon icon={…}> or icon= props.
Custom CSS 5 15 5 stylex declarations: contentMax (maxWidth + marginInline), megaItems (gridColumn + width), megaFeatured (width). All justified (no Astryx prop for capped/centered body width or fixed mega-panel widths) but the count lands in the 4–10 bracket.
Layout & Structure 15 15 Correct AppShell root for a Shell - category; Grid minChildWidth for the responsive tile grid; single page; inert href="#" links.
Doc Metadata 10 10 type, name, description, isReady all present (+ category).
Image Handling 5 5 Featured images use permanent lookaside.facebook.com/assets/astryx/… CDN URLs (no external/placeholder hosts).
Code Quality 10 10 'use client', default export, self-contained imports, realistic mock data, no dead code.
TOTAL 90 100

The only deduction is Custom CSS (5/15) — all load-bearing (centered body cap + equal-width mega panels).

ernestt and others added 3 commits June 26, 2026 15:32
…me list)

CSS `anchor-name` is a comma-separated list, but `useLayer`'s ref callback
set/cleared the whole property — so when two layers anchored to the same
element (e.g. two TopNavMegaMenus in one <nav>), each one clobbered the
other's anchor. The menu that lost its anchor fell back to the viewport
origin and rendered on top of the nav, producing flashing/jumping as the
user hovered between triggers.

This adds anchor-name list helpers (read/write/add/remove) so each layer
appends and removes only its own `anchorId`, leaving sibling layers'
anchors intact.

Fixes #3190

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
A storefront app-shell template under the new "Shell" category. Uses
AppShell (surface variant) as the root with a TopNav featuring two
TopNavMegaMenus (Shop + Brands) — each with a fixed-width 2-column item
grid and a featured card — plus Sale/Service items and search/sign-in/
checkout actions. Body is centered skeleton content (hero + category
tile lockups).

The two mega menus are pinned to identical widths so switching between
them produces no layout shift. Relies on the core anchor-name list fix
(#3193) so both mega menus can anchor to the same nav.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jun 29, 2026 6:53pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 26, 2026
Replace the shimmering Skeleton hero + category tiles with static muted
Card placeholders so the loading state doesn't animate.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other Shell PRs: category: 'Shell - Top Nav' is inert — not a TemplateDoc field (docs-types.ts L636) and generate-data.mjs only extracts name/description/isReady (L688-L691). Please wire it through or drop it.

Separately, this is based on #3193 — worth retargeting to main once that lands so the diff is reviewable on its own.

@ernestt ernestt force-pushed the fix/mega-menu-anchor-collision branch from 726616e to 15b14a4 Compare June 29, 2026 16:48
Add the shell-commerce entry to TEMPLATE_COMPONENTS so the Shell tab in the
docsite templates gallery renders its thumbnail and live preview.

Co-authored-by: Cursor <cursoragent@cursor.com>
Rename the slug shell-commerce → shell-top-nav, set the display name to
"Top Nav", and update the docsite gallery component map.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ernestt ernestt closed this Jun 29, 2026
@ernestt ernestt deleted the feat/shell-commerce-template branch June 29, 2026 18:51
@ernestt ernestt changed the title feat(templates): add Shell — Commerce Marketing page template feat(templates): add Shell — Top Nav page template Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants