Add expanded field to SidebarSubmenuItem

Signed-off-by: Chase Bennett <chase_bennett@carmax.com>
This commit is contained in:
Chase Bennett
2024-02-27 15:11:42 -08:00
committed by Vincenzo Scamporlino
parent 137cee2198
commit 8a96409d53
@@ -131,6 +131,7 @@ export type SidebarSubmenuItemProps = {
icon?: IconComponent;
dropdownItems?: SidebarSubmenuItemDropdownItem[];
exact?: boolean;
expanded?: boolean;
};
/**
@@ -149,7 +150,7 @@ export const SidebarSubmenuItem = (props: SidebarSubmenuItemProps) => {
const currentLocation = useLocation();
let isActive = isLocationMatch(currentLocation, toLocation, exact);
const [showDropDown, setShowDropDown] = useState(false);
const [showDropDown, setShowDropDown] = useState(props.expanded ?? false);
const handleClickDropdown = () => {
setShowDropDown(!showDropDown);
};