@@ -13,6 +13,7 @@ import {
1313 SidebarLabel ,
1414 SidebarSection ,
1515 SidebarSpacer ,
16+ StackedLayout ,
1617} from "../../react-catalyst-ui-kit" ;
1718import {
1819 ChevronDownIcon ,
@@ -34,20 +35,8 @@ import { UserIcon } from "@heroicons/react/24/solid";
3435import { getUrl } from "../../../lib/helpers" ;
3536
3637interface Props {
37- menuItems ?: Array < {
38- label : string ;
39- icon : React . ReactNode ;
40- href : string ;
41- } > ;
42- dropdownHeader ?: {
43- label : string ;
44- icon : React . ReactNode ;
45- } ;
46- dropdownHeaderItems ?: Array < {
47- label : string ;
48- icon : React . ReactNode ;
49- href : string ;
50- } > ;
38+ children ?: React . ReactNode ;
39+
5140 userMenuItems ?: Array < {
5241 label : string ;
5342 icon : React . ReactNode ;
@@ -119,42 +108,37 @@ const HELP_MENU_ITEMS = [
119108 } ,
120109] ;
121110
122- export function SidebarMenu ( {
123- menuItems = DEFAULT_MENU_ITEMS ,
124- dropdownHeader = DEFAULT_DROPDOWN_HEADER ,
125- dropdownHeaderItems = DEFAULT_DROPDOWN_HEADER_ITEMS ,
126- userMenuItems,
127- userInfo,
128- } : Props ) {
129- return (
111+ export function SidebarMenu ( { children, userMenuItems, userInfo } : Props ) {
112+ const sidebarContent = (
130113 < Sidebar >
131114 < SidebarHeader >
132115 < img
133116 src = { getUrl ( "/sum_logo.jpg" ) }
134117 alt = "SUM Logo"
135118 className = "w-40 my-4"
136119 />
137- { dropdownHeader && (
120+ { DEFAULT_DROPDOWN_HEADER && (
138121 < Dropdown >
139122 < DropdownButton as = { SidebarItem } className = "mb-2.5" >
140- { dropdownHeader . icon ? (
141- dropdownHeader . icon
123+ { DEFAULT_DROPDOWN_HEADER . icon ? (
124+ DEFAULT_DROPDOWN_HEADER . icon
142125 ) : (
143126 < Avatar src = "/sum_logo.svg" />
144127 ) }
145- < SidebarLabel > { dropdownHeader . label } </ SidebarLabel >
128+ < SidebarLabel > { DEFAULT_DROPDOWN_HEADER . label } </ SidebarLabel >
146129 < ChevronDownIcon />
147130 </ DropdownButton >
148- { dropdownHeaderItems ?. length && dropdownHeaderItems ?. length > 0 && (
149- < DropdownMenu className = "min-w-64" anchor = "bottom start" >
150- { dropdownHeaderItems . map ( ( item ) => (
151- < DropdownItem key = { item . label } href = { item . href } >
152- { item . icon }
153- < DropdownLabel > { item . label } </ DropdownLabel >
154- </ DropdownItem >
155- ) ) }
156- </ DropdownMenu >
157- ) }
131+ { DEFAULT_DROPDOWN_HEADER_ITEMS ?. length &&
132+ DEFAULT_DROPDOWN_HEADER_ITEMS ?. length > 0 && (
133+ < DropdownMenu className = "min-w-64" anchor = "bottom start" >
134+ { DEFAULT_DROPDOWN_HEADER_ITEMS . map ( ( item ) => (
135+ < DropdownItem key = { item . label } href = { item . href } >
136+ { item . icon }
137+ < DropdownLabel > { item . label } </ DropdownLabel >
138+ </ DropdownItem >
139+ ) ) }
140+ </ DropdownMenu >
141+ ) }
158142 </ Dropdown >
159143 ) }
160144 < SidebarItem key = { HOME_ITEM . label } href = { HOME_ITEM . href } >
@@ -163,9 +147,9 @@ export function SidebarMenu({
163147 </ SidebarItem >
164148 </ SidebarHeader >
165149 < SidebarBody >
166- { menuItems ?. length && menuItems ?. length > 0 && (
150+ { DEFAULT_MENU_ITEMS ?. length && DEFAULT_MENU_ITEMS ?. length > 0 && (
167151 < SidebarSection >
168- { menuItems . map ( ( item ) => (
152+ { DEFAULT_MENU_ITEMS . map ( ( item ) => (
169153 < SidebarItem key = { item . label } href = { item . href } >
170154 { item . icon }
171155 < SidebarLabel > { item . label } </ SidebarLabel >
@@ -229,4 +213,14 @@ export function SidebarMenu({
229213 </ SidebarFooter >
230214 </ Sidebar >
231215 ) ;
216+
217+ return (
218+ < StackedLayout
219+ navbar = { sidebarContent }
220+ sidebar = { sidebarContent }
221+ sidebarOnly = { true }
222+ >
223+ { children }
224+ </ StackedLayout >
225+ ) ;
232226}
0 commit comments