Refactor sidebar navigation to improve render action placement (#133)
- Moved `renderAction` from conditional rendering to a dedicated `SidebarMenuAction` component - Simplified sidebar menu item rendering logic - Ensured consistent placement of additional actions within sidebar menu items
This commit is contained in:
committed by
GitHub
parent
f46286b503
commit
77131d886c
@@ -873,14 +873,6 @@ export function SidebarNavigation({
|
||||
<SidebarMenu>
|
||||
<ContentContainer>
|
||||
{item.children.map((child, childIndex) => {
|
||||
if (child.renderAction) {
|
||||
return (
|
||||
<SidebarMenuSubItem key={child.path}>
|
||||
{child.renderAction}
|
||||
</SidebarMenuSubItem>
|
||||
);
|
||||
}
|
||||
|
||||
const Container = (props: React.PropsWithChildren) => {
|
||||
if ('collapsible' in child && child.collapsible) {
|
||||
return (
|
||||
@@ -1060,6 +1052,10 @@ export function SidebarNavigation({
|
||||
)}
|
||||
</If>
|
||||
</ContentContainer>
|
||||
|
||||
<SidebarMenuAction>
|
||||
{child.renderAction}
|
||||
</SidebarMenuAction>
|
||||
</SidebarMenuItem>
|
||||
</Container>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user