File tree Expand file tree Collapse file tree 2 files changed +43
-24
lines changed Expand file tree Collapse file tree 2 files changed +43
-24
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export function Dropdown<E extends HTMLElement>(props: {
39
39
aria-labelledby = { dropdownId }
40
40
className = { tcls (
41
41
'w-52' ,
42
- 'max-h-56 ' ,
42
+ 'max-h-80 ' ,
43
43
'flex' ,
44
44
'absolute' ,
45
45
'top-full' ,
@@ -111,31 +111,38 @@ export function DropdownMenu(props: { children: React.ReactNode }) {
111
111
* Menu item in a dropdown.
112
112
*/
113
113
export function DropdownMenuItem ( props : {
114
- href : string ;
114
+ href : string | null ;
115
115
active ?: boolean ;
116
+ className ?: ClassValue ;
116
117
children : React . ReactNode ;
117
118
} ) {
118
- const { children, active = false , href } = props ;
119
+ const { children, active = false , href, className } = props ;
120
+
121
+ if ( href ) {
122
+ return (
123
+ < Link
124
+ href = { href }
125
+ prefetch = { false }
126
+ className = { tcls (
127
+ 'px-3 py-1 text-sm rounded straight-corners:rounded-sm' ,
128
+ active ? 'bg-primary/3 dark:bg-light/2 text-primary-600' : null ,
129
+ 'hover:bg-dark/2 dark:hover:bg-light/2' ,
130
+ className ,
131
+ ) }
132
+ >
133
+ { children }
134
+ </ Link >
135
+ ) ;
136
+ }
119
137
120
138
return (
121
- < Link
122
- href = { href }
123
- prefetch = { false }
139
+ < div
124
140
className = { tcls (
125
- 'flex' ,
126
- 'flex-row' ,
127
- 'items-center' ,
128
- 'text-sm' ,
129
- 'px-3' ,
130
- 'py-1' ,
131
- 'rounded' ,
132
- 'straight-corners:rounded-sm' ,
133
- active
134
- ? [ 'bg-primary/3' , 'dark:bg-light/2' , 'text-primary-600' ]
135
- : [ 'hover:bg-dark/2' , 'dark:hover:bg-light/2' ] ,
141
+ 'text-xs px-3 py-1 font-medium text-dark/8 dark:text-light/8' ,
142
+ className ,
136
143
) }
137
144
>
138
145
{ children }
139
- </ Link >
146
+ </ div >
140
147
) ;
141
148
}
Original file line number Diff line number Diff line change 1
1
import {
2
+ CustomizationContentLink ,
2
3
CustomizationHeaderItem ,
3
4
CustomizationHeaderPreset ,
4
5
CustomizationSettings ,
@@ -55,14 +56,25 @@ export function HeaderLinkMore(props: {
55
56
) ;
56
57
}
57
58
58
- async function MoreMenuLink ( props : { context : ContentRefContext ; link : CustomizationHeaderItem } ) {
59
+ async function MoreMenuLink ( props : {
60
+ context : ContentRefContext ;
61
+ link : CustomizationHeaderItem | CustomizationContentLink ;
62
+ } ) {
59
63
const { context, link } = props ;
60
64
61
65
const target = link . to ? await resolveContentRef ( link . to , context ) : null ;
62
66
63
- if ( ! target ) {
64
- return null ;
65
- }
66
-
67
- return < DropdownMenuItem href = { target . href } > { link . title } </ DropdownMenuItem > ;
67
+ return (
68
+ < >
69
+ { 'links' in link && link . links . length > 0 && (
70
+ < hr className = "first:hidden border-t border-light-3 dark:border-dark-3 my-1 -mx-2" />
71
+ ) }
72
+ < DropdownMenuItem href = { target ?. href ?? null } > { link . title } </ DropdownMenuItem >
73
+ { 'links' in link
74
+ ? link . links . map ( ( subLink , index ) => (
75
+ < MoreMenuLink key = { index } { ...props } link = { subLink } />
76
+ ) )
77
+ : null }
78
+ </ >
79
+ ) ;
68
80
}
You can’t perform that action at this time.
0 commit comments