Web: Components: Sub-menu: fixed mobile view

This commit is contained in:
Nikita Gopienko 2023-09-07 15:15:48 +03:00
parent 6ef9318372
commit a142da6260

View File

@ -12,7 +12,7 @@ import Scrollbar from "../../scrollbar";
import ToggleButton from "../../toggle-button";
import { SubMenuItem } from "../styled-context-menu";
import Loaders from "@docspace/common/components/Loaders";
import { isMobile } from "react-device-detect";
import { isMobile, isMobileOnly } from "react-device-detect";
const SubMenu = (props) => {
const {
@ -33,7 +33,7 @@ const SubMenu = (props) => {
const theme = useTheme();
const onItemMouseEnter = (e, item) => {
if (item.disabled || isMobile) {
if (item.disabled) {
e.preventDefault();
return;
}
@ -44,8 +44,9 @@ const SubMenu = (props) => {
const onItemClick = (e, item) => {
if (item.onLoad) {
e.preventDefault();
if (!isMobileOnly) return;
if (isMobile) onMobileItemClick(e, item.onLoad);
if (isMobileOnly) onMobileItemClick(e, item.onLoad);
else onLeafClick(e);
return;
}