feat: MenuNav layer for the SummerCMS menu API
- typed client and useMenu/useMenuApi (SSR, menu:<code>:<locale> key, server and public bases, x-forwarded-for forwarded also on cached renders) - MenuNav and recursive MenuNavItem: WAI disclosure navigation, URL allowlist with a text fallback, rel on _blank, active link and trail, mobile toggle, Esc / focus-out / outside pointer / route change closing - menu tokens and base CSS, README - node tests (link rules, client, server-rendered NavItem) and a playground SSR smoke against a fixture API
This commit is contained in:
39
testing/fixtures/menus/main.json
Normal file
39
testing/fixtures/menus/main.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"data": {
|
||||
"code": "main",
|
||||
"name": "Main",
|
||||
"css_class": "nav-main",
|
||||
"items": [
|
||||
{ "id": 1, "title": "Home", "type": "url", "url": "/", "target": "_self", "css_class": null, "icon": null, "code": "home", "items": [] },
|
||||
{
|
||||
"id": 2,
|
||||
"title": "About",
|
||||
"type": "url",
|
||||
"url": "/about",
|
||||
"target": null,
|
||||
"css_class": null,
|
||||
"icon": null,
|
||||
"code": null,
|
||||
"items": [
|
||||
{ "id": 3, "title": "Team", "type": "url", "url": "/about/team", "target": null, "css_class": null, "icon": null, "code": null, "items": [] }
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Topics",
|
||||
"type": "acme-list",
|
||||
"url": "#",
|
||||
"target": null,
|
||||
"css_class": null,
|
||||
"icon": null,
|
||||
"code": null,
|
||||
"items": [
|
||||
{ "id": null, "title": "First topic", "type": "acme-list", "url": "/first-topic", "target": null, "css_class": null, "icon": null, "code": null, "items": [] },
|
||||
{ "id": null, "title": "Unsafe topic", "type": "acme-list", "url": "javascript:alert(1)", "target": null, "css_class": null, "icon": null, "code": null, "items": [] }
|
||||
]
|
||||
},
|
||||
{ "id": 5, "title": "", "type": "divider", "url": null, "target": null, "css_class": null, "icon": null, "code": null, "items": [] },
|
||||
{ "id": 6, "title": "Partner", "type": "url", "url": "https://partner.example.test/", "target": "_blank", "css_class": "nav-ext", "icon": null, "code": null, "items": [] }
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user