diff --git a/src/design-system/layout/Sidebar/Sidebar.test.tsx b/src/design-system/layout/Sidebar/Sidebar.test.tsx
index 21c8f52..b308ae3 100644
--- a/src/design-system/layout/Sidebar/Sidebar.test.tsx
+++ b/src/design-system/layout/Sidebar/Sidebar.test.tsx
@@ -324,4 +324,73 @@ describe('Sidebar compound component', () => {
const item = screen.getByText('Admin').closest('[role="button"]')!
expect(item.className).toMatch(/bottomItemActive/)
})
+
+ // 17. renders sectionContent wrapper with maxHeight when open
+ it('renders section content wrapper with maxHeight style when open', () => {
+ const { container } = render(
+
+
+ ic}
+ label="Apps"
+ open
+ onToggle={vi.fn()}
+ maxHeight="200px"
+ >
+ child
+
+
+ ,
+ )
+
+ const contentWrapper = container.querySelector('.sectionContent')
+ expect(contentWrapper).toBeInTheDocument()
+ expect(contentWrapper).toHaveStyle({ maxHeight: '200px' })
+ expect(screen.getByText('child')).toBeInTheDocument()
+ })
+
+ // 18. renders sectionContent wrapper without maxHeight when not provided
+ it('renders section content wrapper without inline maxHeight when maxHeight is not provided', () => {
+ const { container } = render(
+
+
+ ic}
+ label="Apps"
+ open
+ onToggle={vi.fn()}
+ >
+ child
+
+
+ ,
+ )
+
+ const contentWrapper = container.querySelector('.sectionContent')
+ expect(contentWrapper).toBeInTheDocument()
+ expect(contentWrapper).not.toHaveStyle({ maxHeight: '200px' })
+ expect(screen.getByText('child')).toBeInTheDocument()
+ })
+
+ // 19. does not render sectionContent wrapper when section is closed
+ it('does not render section content wrapper when section is closed', () => {
+ const { container } = render(
+
+
+ ic}
+ label="Apps"
+ open={false}
+ onToggle={vi.fn()}
+ maxHeight="200px"
+ >
+ child
+
+
+ ,
+ )
+
+ const contentWrapper = container.querySelector('.sectionContent')
+ expect(contentWrapper).not.toBeInTheDocument()
+ })
})
diff --git a/src/design-system/layout/Sidebar/Sidebar.tsx b/src/design-system/layout/Sidebar/Sidebar.tsx
index f154c9f..8dddcc3 100644
--- a/src/design-system/layout/Sidebar/Sidebar.tsx
+++ b/src/design-system/layout/Sidebar/Sidebar.tsx
@@ -26,6 +26,8 @@ interface SidebarSectionProps {
active?: boolean
children: ReactNode
className?: string
+ position?: 'top' | 'bottom'
+ maxHeight?: string
}
interface SidebarFooterProps {
@@ -83,6 +85,8 @@ function SidebarSection({
active,
children,
className,
+ position: _position,
+ maxHeight,
}: SidebarSectionProps) {
const { collapsed, onCollapseToggle } = useSidebarContext()
@@ -125,7 +129,14 @@ function SidebarSection({
{icon && {icon}}
{label}
- {open && children}
+ {open && (
+
+ {children}
+
+ )}
)
}