File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,15 @@ import {
5
5
MenuItem as AriaMenuItem ,
6
6
MenuProps as AriaMenuProps ,
7
7
MenuItemProps ,
8
+ MenuSection as AriaMenuSection ,
9
+ MenuSectionProps as AriaMenuSectionProps ,
8
10
Separator ,
9
11
SeparatorProps ,
10
- composeRenderProps
12
+ composeRenderProps ,
13
+ Header ,
14
+ Collection
11
15
} from 'react-aria-components' ;
12
- import { DropdownSection , DropdownSectionProps , dropdownItemStyles } from './ListBox' ;
16
+ import { dropdownItemStyles } from './ListBox' ;
13
17
import { Popover , PopoverProps } from './Popover' ;
14
18
15
19
interface MenuProps < T > extends AriaMenuProps < T > {
@@ -48,6 +52,18 @@ export function MenuSeparator(props: SeparatorProps) {
48
52
return < Separator { ...props } className = "mx-3 my-1 border-b border-gray-300 dark:border-zinc-700" />
49
53
}
50
54
51
- export function MenuSection < T extends object > ( props : DropdownSectionProps < T > ) {
52
- return < DropdownSection { ...props } /> ;
55
+ export interface MenuSectionProps < T > extends AriaMenuSectionProps < T > {
56
+ title ?: string
57
+ items ?: any
58
+ }
59
+
60
+ export function MenuSection < T extends object > ( props : MenuSectionProps < T > ) {
61
+ return (
62
+ < AriaMenuSection className = "first:-mt-[5px] after:content-[''] after:block after:h-[5px]" >
63
+ < Header className = "text-sm font-semibold text-gray-500 dark:text-zinc-300 px-4 py-1 truncate sticky -top-[5px] -mt-px -mx-1 z-10 bg-gray-100/60 dark:bg-zinc-700/60 backdrop-blur-md supports-[-moz-appearance:none]:bg-gray-100 border-y dark:border-y-zinc-700 [&+*]:mt-1" > { props . title } </ Header >
64
+ < Collection items = { props . items } >
65
+ { props . children }
66
+ </ Collection >
67
+ </ AriaMenuSection >
68
+ )
53
69
}
You can’t perform that action at this time.
0 commit comments