@ninjainfosys/site-kit 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ninjainfosys/site-kit",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Shared blog, glossary, SEO, layout and build tooling for the Ninja Infosys Astro marketing sites.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,6 +10,10 @@ import { kit } from '../../config';
10
10
  const { groups, plain, utility, logo, action, mobileLinks, mobileCall, homeLabel } = kit.header;
11
11
  const path = Astro.url.pathname.replace(/\.html$/, '');
12
12
  const current = (href: string) => (path === href || path.startsWith(`${href}/`) ? 'page' : undefined);
13
+ // The group a page belongs to: the one that lists it. Groups may share a base
14
+ // (two menus over /products), so the base only decides when no group lists the page.
15
+ const listed = groups.find((g) => g.links.some((l) => current(l.href)));
16
+ const inGroup = (g: (typeof groups)[number]) => (listed ? g === listed : path.startsWith(g.base));
13
17
  ---
14
18
  <div class="utility">
15
19
  <div class="wrap u-row">
@@ -35,7 +39,7 @@ const current = (href: string) => (path === href || path.startsWith(`${href}/`)
35
39
  {groups.map((g) => (
36
40
  <li>
37
41
  <details class="menu" data-menu>
38
- <summary aria-current={path.startsWith(g.base) ? 'page' : undefined}>{g.label}</summary>
42
+ <summary aria-current={inGroup(g) ? 'page' : undefined}>{g.label}</summary>
39
43
  <div class="mega">
40
44
  <div class="wrap mega-grid">
41
45
  <ul class="mega-links">
@@ -66,7 +70,7 @@ const current = (href: string) => (path === href || path.startsWith(`${href}/`)
66
70
  <ul class="m-list">
67
71
  {groups.map((g) => (
68
72
  <li>
69
- <details class="m-acc" open={path.startsWith(g.base) || undefined}>
73
+ <details class="m-acc" open={inGroup(g) || undefined}>
70
74
  <summary class="m-row">{g.label}<ChevronDown class="m-chev" size={22} stroke-width={2} aria-hidden="true" /></summary>
71
75
  <ul class="m-sub">
72
76
  {g.links.map((l) => <li><a href={l.href} aria-current={current(l.href)}>{l.label}</a></li>)}