Skip to content

Commit

Permalink
Merge pull request #1669 from terrestris/mobileToolMenu
Browse files Browse the repository at this point in the history
fix: adjust width in mobile version
  • Loading branch information
TreffN committed Jun 27, 2024
2 parents 9bc4b18 + 7de1d41 commit b90ae73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/ToolMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ export type ToolPanelConfig = {
};

export type ToolMenuProps = Partial<CollapsePanelProps> & {
collapseWidth?: number;
minWidth?: number;
maxWidth?: number;
};

export const ToolMenu: React.FC<ToolMenuProps> = ({
collapseWidth = 40,
minWidth = 240,
maxWidth = 600,
...restProps
Expand Down Expand Up @@ -128,8 +130,9 @@ export const ToolMenu: React.FC<ToolMenuProps> = ({

if (isMobile) {
setCollapsed(true);
setWidth(collapseWidth);
}
}, []);
}, [collapseWidth]);

useEffect(() => {
if (menuTools.length < 1) {
Expand Down Expand Up @@ -419,7 +422,7 @@ export const ToolMenu: React.FC<ToolMenuProps> = ({
if (collapsed){
setWidth(noCollapseWidth);
} else {
setWidth(40);
setWidth(collapseWidth);
}
}}
/>
Expand Down

0 comments on commit b90ae73

Please sign in to comment.