diff --git a/src/widgets/Menu/Accordion.tsx b/src/widgets/Menu/Accordion.tsx index 83202e606..ef49176fe 100644 --- a/src/widgets/Menu/Accordion.tsx +++ b/src/widgets/Menu/Accordion.tsx @@ -8,6 +8,7 @@ import { ArrowDropDownIcon, ArrowDropUpIcon } from "../../components/Svg"; interface Props extends PushedProps { label: string; icon: React.ReactElement; + initialOpenState?: boolean; } const Container = styled.div` @@ -24,8 +25,8 @@ const AccordionContent = styled.div<{ isOpen: boolean; isPushed: boolean; maxHei border-top: ${({ isOpen, isPushed }) => (isOpen && isPushed ? "solid 2px rgba(133, 133, 133, 0.1)" : 0)}; `; -const Accordion: React.FC = ({ label, icon, isPushed, pushNav, children }) => { - const [isOpen, setIsOpen] = useState(false); +const Accordion: React.FC = ({ label, icon, isPushed, pushNav, initialOpenState = false, children }) => { + const [isOpen, setIsOpen] = useState(initialOpenState); const handleClick = () => { if (isPushed) { diff --git a/src/widgets/Menu/PanelBody.tsx b/src/widgets/Menu/PanelBody.tsx index bb4737725..193586a85 100644 --- a/src/widgets/Menu/PanelBody.tsx +++ b/src/widgets/Menu/PanelBody.tsx @@ -33,7 +33,14 @@ const PanelBody: React.FC = ({ isPushed, pushNav, isMobile, links }) => { const iconElement = ; if (entry.items) { return ( - + {isPushed && entry.items.map((item) => ( diff --git a/src/widgets/Menu/types.ts b/src/widgets/Menu/types.ts index c14aad38f..6c780a15b 100644 --- a/src/widgets/Menu/types.ts +++ b/src/widgets/Menu/types.ts @@ -25,6 +25,7 @@ export interface MenuEntry { icon: string; items?: MenuSubEntry[]; href?: string; + initialOpenState?: boolean; } export interface PanelProps {