fix: build
This commit is contained in:
parent
b142b93666
commit
1cb9503c93
2 changed files with 10 additions and 6 deletions
|
|
@ -134,9 +134,14 @@ const SidebarItem: React.FC<SidebarItemProps> = React.memo(({
|
||||||
buttonPosition: buttonComputed?.position,
|
buttonPosition: buttonComputed?.position,
|
||||||
buttonRect: button ? button.getBoundingClientRect() : null,
|
buttonRect: button ? button.getBoundingClientRect() : null,
|
||||||
elementsAtIconCenter: elementsAtPoint.slice(0, 5).map(el => {
|
elementsAtIconCenter: elementsAtPoint.slice(0, 5).map(el => {
|
||||||
const className = typeof el.className === 'string'
|
let className: string = '';
|
||||||
? el.className
|
if (typeof el.className === 'string') {
|
||||||
: (el.className?.baseVal || el.className?.toString() || '');
|
className = el.className;
|
||||||
|
} else if (el.className && typeof el.className === 'object' && 'baseVal' in el.className) {
|
||||||
|
className = (el.className as { baseVal?: string }).baseVal || '';
|
||||||
|
} else if (el.className) {
|
||||||
|
className = String(el.className);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
tag: el.tagName,
|
tag: el.tagName,
|
||||||
class: className?.split(' ')[0] || 'no-class',
|
class: className?.split(' ')[0] || 'no-class',
|
||||||
|
|
@ -214,7 +219,6 @@ const SidebarItem: React.FC<SidebarItemProps> = React.memo(({
|
||||||
const subIsActive = isSubmenuItemActive(subitem.link);
|
const subIsActive = isSubmenuItemActive(subitem.link);
|
||||||
const hasNestedSubmenu = subitem.submenu && subitem.submenu.length > 0;
|
const hasNestedSubmenu = subitem.submenu && subitem.submenu.length > 0;
|
||||||
const subIsOpen = nestedOpenStates[subitem.id] || false;
|
const subIsOpen = nestedOpenStates[subitem.id] || false;
|
||||||
const subDepth = subitem.depth !== undefined ? subitem.depth : (depth === 0 ? 1 : depth + 1);
|
|
||||||
|
|
||||||
// In minimized mode, items with nested submenus should render as icon buttons
|
// In minimized mode, items with nested submenus should render as icon buttons
|
||||||
// Their submenu will expand below them when clicked
|
// Their submenu will expand below them when clicked
|
||||||
|
|
|
||||||
|
|
@ -409,8 +409,8 @@ export interface SidebarItem {
|
||||||
export interface SidebarSubmenuItemData {
|
export interface SidebarSubmenuItemData {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
link: string;
|
link?: string; // Optional - if undefined, it's a navigation node (not a page)
|
||||||
icon?: IconType;
|
icon?: IconType | React.ComponentType<React.SVGProps<SVGSVGElement>>; // Allow both IconType and SVG components
|
||||||
submenu?: SidebarSubmenuItemData[]; // Recursive support for nested submenus
|
submenu?: SidebarSubmenuItemData[]; // Recursive support for nested submenus
|
||||||
depth?: number; // Hierarchy depth for indentation (0 = top level)
|
depth?: number; // Hierarchy depth for indentation (0 = top level)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue