@meith/theme-default 0.8.0 → 0.10.0

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": "@meith/theme-default",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Meith's default theme — every slot and every token, and the reference for what a complete theme fills.",
5
5
  "license": "LGPL-3.0-or-later",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@meith/theme-kit": "^0.8.0",
24
- "@meith/ui": "^0.8.0"
23
+ "@meith/theme-kit": "^0.10.0",
24
+ "@meith/ui": "^0.10.0"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": "^19.2.0"
@@ -1,5 +1,5 @@
1
1
  import type { HeaderModel, SlotCopy } from '@meith/theme-kit'
2
- import { fromSlotCopy } from '@meith/theme-kit'
2
+ import { fromSlotCopy, linkTarget } from '@meith/theme-kit'
3
3
 
4
4
  import { LINK, PAGE } from '../shared'
5
5
 
@@ -25,6 +25,26 @@ function BoardMark({ boardTitle, logo }: Pick<HeaderModel, 'boardTitle' | 'logo'
25
25
  )
26
26
  }
27
27
 
28
+ function Submenu({ items }: { items: HeaderModel['navigation'][number]['submenu'] }) {
29
+ if (items === undefined || items.length === 0) return null
30
+
31
+ return (
32
+ <ul className="invisible absolute top-full left-0 z-30 min-w-44 rounded-b-md border border-border bg-card py-1 opacity-0 shadow-elevation transition-opacity group-focus-within:visible group-focus-within:opacity-100 group-hover:visible group-hover:opacity-100">
33
+ {items.map((child) => (
34
+ <li key={child.href}>
35
+ <a
36
+ href={child.href}
37
+ {...linkTarget(child)}
38
+ className="block px-3 py-1.5 text-muted-foreground hover:bg-muted hover:text-foreground"
39
+ >
40
+ {child.label}
41
+ </a>
42
+ </li>
43
+ ))}
44
+ </ul>
45
+ )
46
+ }
47
+
28
48
  export function Header({
29
49
  boardTitle,
30
50
  homeHref,
@@ -35,6 +55,8 @@ export function Header({
35
55
  }: HeaderModel & { copy: SlotCopy }) {
36
56
  const c = (key: string) => fromSlotCopy(copy, `default.header.${key}`)
37
57
 
58
+ const opensMenus = navigation.some((item) => item.submenu !== undefined)
59
+
38
60
  return (
39
61
  <header className="border-b border-border bg-card">
40
62
  <div className={`${PAGE} flex flex-wrap items-center justify-between gap-x-6 gap-y-3 py-3`}>
@@ -50,15 +72,23 @@ export function Header({
50
72
  {navigation.length > 0 && (
51
73
  <nav aria-label={c('sections')} className="border-t border-border bg-surface">
52
74
  <div className={PAGE}>
53
- <ul className="-mx-4 flex items-stretch gap-1 overflow-x-auto px-4 text-sm [mask-image:linear-gradient(to_right,black_calc(100%-1.5rem),transparent)] sm:-mx-6 sm:px-6 sm:[mask-image:none]">
75
+ <ul
76
+ className={`-mx-4 flex items-stretch gap-1 px-4 text-sm sm:-mx-6 sm:px-6 ${
77
+ opensMenus
78
+ ? 'flex-wrap'
79
+ : 'overflow-x-auto [mask-image:linear-gradient(to_right,black_calc(100%-1.5rem),transparent)] sm:[mask-image:none]'
80
+ }`}
81
+ >
54
82
  {navigation.map((item) => (
55
- <li key={item.href} className="shrink-0">
83
+ <li key={item.href} className="group relative shrink-0">
56
84
  <a
57
85
  href={item.href}
86
+ {...linkTarget(item)}
58
87
  className="inline-flex h-10 items-center rounded-t-md border-b-2 border-transparent px-2.5 font-medium text-muted-foreground transition-colors hover:border-border hover:text-foreground"
59
88
  >
60
89
  {item.label}
61
90
  </a>
91
+ <Submenu items={item.submenu} />
62
92
  </li>
63
93
  ))}
64
94
  </ul>