Merge pull request #23301 from carnageX/master
feat: Add option for SidebarSubmenuItem to have sub menus expanded by default
This commit is contained in:
@@ -1128,6 +1128,7 @@ export type SidebarSubmenuItemProps = {
|
||||
icon?: IconComponent;
|
||||
dropdownItems?: SidebarSubmenuItemDropdownItem[];
|
||||
exact?: boolean;
|
||||
initialShowDropdown?: boolean;
|
||||
};
|
||||
|
||||
// @public
|
||||
|
||||
@@ -131,6 +131,7 @@ export type SidebarSubmenuItemProps = {
|
||||
icon?: IconComponent;
|
||||
dropdownItems?: SidebarSubmenuItemDropdownItem[];
|
||||
exact?: boolean;
|
||||
initialShowDropdown?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -149,7 +150,9 @@ export const SidebarSubmenuItem = (props: SidebarSubmenuItemProps) => {
|
||||
const currentLocation = useLocation();
|
||||
let isActive = isLocationMatch(currentLocation, toLocation, exact);
|
||||
|
||||
const [showDropDown, setShowDropDown] = useState(false);
|
||||
const [showDropDown, setShowDropDown] = useState(
|
||||
props.initialShowDropdown ?? false,
|
||||
);
|
||||
const handleClickDropdown = () => {
|
||||
setShowDropDown(!showDropDown);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user