@@ -9,6 +9,7 @@ import { Button } from '@primereact/ui/button';
99import { Drawer } from '@primereact/ui/drawer' ;
1010import { IconField } from '@primereact/ui/iconfield' ;
1111import { InputText } from '@primereact/ui/inputtext' ;
12+ import { Menu } from '@primereact/ui/menu' ;
1213import * as React from 'react' ;
1314
1415const navSections = [
@@ -51,13 +52,12 @@ export default function BasicDemo() {
5152 < Drawer . Portal className = "w-full md:w-80" >
5253 < Drawer . Header >
5354 < Drawer . Title > Drawer Title</ Drawer . Title >
54- < Drawer . Close as = { Button } iconOnly variant = " text" rounded severity = "secondary ">
55+ < Drawer . Close className = "w-8 h-8 rounded-full flex items-center justify-center text-surface-500 dark:text-surface-400 hover:bg-surface-100 dark:hover:bg-surface-800 focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2 focus-visible:outline-primary transition-colors ">
5556 < Times />
5657 </ Drawer . Close >
5758 </ Drawer . Header >
5859 < Drawer . Content pt = { { root : 'p-0' } } >
5960 < div className = "flex flex-col h-full" >
60- { /* Search */ }
6161 < div className = "px-4 pb-4" >
6262 < IconField . Root >
6363 < IconField . Inset >
@@ -72,58 +72,44 @@ export default function BasicDemo() {
7272 </ IconField . Root >
7373 </ div >
7474
75- { /* Navigation */ }
76- < div className = "flex-1 overflow-y-auto px-3" >
77- { navSections . map ( ( section ) => (
78- < div key = { section . label } className = "mb-4" >
79- < span className = "text-xs font-semibold text-surface-500 dark:text-surface-400 px-3 mb-2 block tracking-wider" >
80- { section . label }
81- </ span >
82- < ul className = "list-none m-0 p-0" >
83- { section . items . map ( ( item ) => (
84- < li key = { item . label } >
85- < a
86- className = { `flex items-center gap-3 px-3 py-2.5 rounded-lg cursor-pointer transition-all mb-0.5 ${
87- item . active
88- ? 'bg-primary text-primary-contrast'
89- : 'text-surface-700 dark:text-surface-200 hover:bg-surface-100 dark:hover:bg-surface-800'
90- } `}
75+ < div className = "flex-1 overflow-y-auto px-4" >
76+ < Menu . Root className = "w-full border-0 bg-transparent p-0" >
77+ < Menu . List className = "gap-0" >
78+ { navSections . map ( ( section , sectionIndex ) => (
79+ < React . Fragment key = { section . label } >
80+ < Menu . Label className = { `text-primary font-semibold text-xs tracking-wider px-0 py-1${ sectionIndex > 0 ? ' mt-4' : '' } ` } >
81+ { section . label }
82+ </ Menu . Label >
83+ { section . items . map ( ( item ) => (
84+ < Menu . Item
85+ key = { item . label }
86+ className = { `text-sm hover:bg-transparent px-0 py-2.5${ item . active ? ' text-primary font-semibold' : '' } ` }
9187 >
92- < i className = { `${ item . icon } text-base` } />
93- < span className = "font-medium text-sm" > { item . label } </ span >
88+ < i className = { `${ item . icon } text-base${ item . active ? ' text-primary' : '' } ` } />
89+ { item . label }
9490 { item . badge && (
9591 < Badge
96- severity = { item . active ? 'secondary' : undefined }
9792 shape = "circle"
9893 className = "ml-auto"
9994 >
10095 { item . badge }
10196 </ Badge >
10297 ) }
103- </ a >
104- </ li >
105- ) ) }
106- </ ul >
107- </ div >
108- ) ) }
98+ </ Menu . Item >
99+ ) ) }
100+ </ React . Fragment >
101+ ) ) }
109102
110- { /* Recent Activity */ }
111- < div className = "mb-4" >
112- < span className = "text-xs font-semibold text-surface-500 dark:text-surface-400 px-3 mb-2 block tracking-wider" >
113- RECENT
114- </ span >
115- < ul className = "list-none m-0 p-0" >
103+ < Menu . Label className = "text-primary font-semibold text-xs tracking-wider px-0 py-1 mt-4" > RECENT</ Menu . Label >
116104 { recentItems . map ( ( item ) => (
117- < li key = { item . label } >
118- < a className = "flex items-center gap-3 px-3 py-2.5 rounded-lg cursor-pointer text-surface-700 dark:text-surface-200 hover:bg-surface-100 dark:hover:bg-surface-800 transition-all mb-0.5" >
119- < span className = { `${ item . color } w-2 h-2 rounded-full shrink-0` } />
120- < span className = "font-medium text-sm truncate" > { item . label } </ span >
121- < span className = "text-xs text-surface-400 ml-auto shrink-0" > { item . time } </ span >
122- </ a >
123- </ li >
105+ < Menu . Item key = { item . label } className = "text-sm hover:bg-transparent px-0 py-2.5" >
106+ < span className = { `${ item . color } w-2 h-2 rounded-full shrink-0` } />
107+ < span className = "truncate" > { item . label } </ span >
108+ < span className = "text-xs text-surface-400 ml-auto shrink-0" > { item . time } </ span >
109+ </ Menu . Item >
124110 ) ) }
125- </ ul >
126- </ div >
111+ </ Menu . List >
112+ </ Menu . Root >
127113 </ div >
128114 </ div >
129115 </ Drawer . Content >
0 commit comments