@meith/theme-phasebook 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 +4 -4
- package/src/slots/header.tsx +34 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meith/theme-phasebook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "A theme for Meith with a familiar social shape, built on the default theme's slots.",
|
|
5
5
|
"license": "LGPL-3.0-or-later",
|
|
6
6
|
"repository": {
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@meith/
|
|
24
|
-
"@meith/
|
|
25
|
-
"@meith/theme-kit": "^0.
|
|
23
|
+
"@meith/theme-default": "^0.10.0",
|
|
24
|
+
"@meith/ui": "^0.10.0",
|
|
25
|
+
"@meith/theme-kit": "^0.10.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^19.2.0"
|
package/src/slots/header.tsx
CHANGED
|
@@ -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 { PAGE } from '../shared'
|
|
5
5
|
|
|
@@ -36,6 +36,26 @@ function BoardMark({ boardTitle, logo }: Pick<HeaderModel, 'boardTitle' | 'logo'
|
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
function Submenu({ items }: { items: HeaderModel['navigation'][number]['submenu'] }) {
|
|
40
|
+
if (items === undefined || items.length === 0) return null
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<ul className="invisible absolute top-full left-0 z-30 min-w-44 rounded-xl border border-border bg-card py-1 text-sm opacity-0 shadow-elevation transition-opacity group-focus-within:visible group-focus-within:opacity-100 group-hover:visible group-hover:opacity-100">
|
|
44
|
+
{items.map((child) => (
|
|
45
|
+
<li key={child.href}>
|
|
46
|
+
<a
|
|
47
|
+
href={child.href}
|
|
48
|
+
{...linkTarget(child)}
|
|
49
|
+
className="block px-4 py-2 text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
50
|
+
>
|
|
51
|
+
{child.label}
|
|
52
|
+
</a>
|
|
53
|
+
</li>
|
|
54
|
+
))}
|
|
55
|
+
</ul>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
39
59
|
export function Header({
|
|
40
60
|
boardTitle,
|
|
41
61
|
homeHref,
|
|
@@ -46,6 +66,8 @@ export function Header({
|
|
|
46
66
|
}: HeaderModel & { copy: SlotCopy }) {
|
|
47
67
|
const c = (key: string) => fromSlotCopy(copy, `phasebook.header.${key}`)
|
|
48
68
|
|
|
69
|
+
const opensMenus = navigation.some((item) => item.submenu !== undefined)
|
|
70
|
+
|
|
49
71
|
return (
|
|
50
72
|
<header className="sticky top-0 z-30 border-b border-border bg-card shadow-elevation">
|
|
51
73
|
<div className={`${PAGE} flex h-14 items-center justify-between gap-3`}>
|
|
@@ -66,13 +88,15 @@ export function Header({
|
|
|
66
88
|
>
|
|
67
89
|
<ul className="flex items-center gap-1">
|
|
68
90
|
{navigation.map((item) => (
|
|
69
|
-
<li key={item.href}>
|
|
91
|
+
<li key={item.href} className="group relative">
|
|
70
92
|
<a
|
|
71
93
|
href={item.href}
|
|
94
|
+
{...linkTarget(item)}
|
|
72
95
|
className="inline-flex h-11 items-center rounded-lg px-6 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
|
73
96
|
>
|
|
74
97
|
{item.label}
|
|
75
98
|
</a>
|
|
99
|
+
<Submenu items={item.submenu} />
|
|
76
100
|
</li>
|
|
77
101
|
))}
|
|
78
102
|
</ul>
|
|
@@ -84,15 +108,21 @@ export function Header({
|
|
|
84
108
|
|
|
85
109
|
{navigation.length > 0 && (
|
|
86
110
|
<nav aria-label={c('sectionsAriaLabel')} className="border-t border-border lg:hidden">
|
|
87
|
-
<ul
|
|
111
|
+
<ul
|
|
112
|
+
className={`${PAGE} flex items-center gap-1 py-1 ${
|
|
113
|
+
opensMenus ? 'flex-wrap' : 'overflow-x-auto'
|
|
114
|
+
}`}
|
|
115
|
+
>
|
|
88
116
|
{navigation.map((item) => (
|
|
89
|
-
<li key={item.href} className="shrink-0">
|
|
117
|
+
<li key={item.href} className="group relative shrink-0">
|
|
90
118
|
<a
|
|
91
119
|
href={item.href}
|
|
120
|
+
{...linkTarget(item)}
|
|
92
121
|
className="inline-flex h-9 items-center rounded-full px-3 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
|
93
122
|
>
|
|
94
123
|
{item.label}
|
|
95
124
|
</a>
|
|
125
|
+
<Submenu items={item.submenu} />
|
|
96
126
|
</li>
|
|
97
127
|
))}
|
|
98
128
|
</ul>
|