Skip to content

Commit 5d93149

Browse files
authored
Merge pull request #1042 from vr-varad/fix/whats_new
Whats New Display Fix
2 parents b2ab1f5 + 9c5b13f commit 5d93149

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/custom/NavigationNavbar/navigationNavbar.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ExpandLessIcon from '@mui/icons-material/ExpandLess';
22
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
3-
import { ListItemTextProps, MenuListProps } from '@mui/material';
3+
import { ListItemTextProps, MenuListProps, useMediaQuery, useTheme } from '@mui/material';
44
import React, { MouseEvent, useState } from 'react';
55
import { Collapse, Divider, ListItemText, MenuItem } from '../../base';
66
import { IconWrapper, MenuItemList, MenuItemSubList, MenuListStyle, SubIconWrapper } from './style';
@@ -13,6 +13,7 @@ type NavigationItem = {
1313
onClick: () => void;
1414
subItems?: NavigationItem[];
1515
addDivider?: boolean;
16+
showOnWeb?: boolean;
1617
};
1718

1819
interface NavigationNavbarProps {
@@ -26,6 +27,8 @@ const NavigationNavbar: React.FC<NavigationNavbarProps> = ({
2627
MenuListProps = {},
2728
ListItemTextProps = {}
2829
}) => {
30+
const theme = useTheme();
31+
const isDesktop = useMediaQuery(theme.breakpoints.up('sm'));
2932
const [openSectionId, setOpenSectionId] = useState<string | null>(null);
3033
const toggleSectionOpen = (sectionId: string, event: MouseEvent<SVGSVGElement>) => {
3134
event.stopPropagation();
@@ -41,6 +44,12 @@ const NavigationNavbar: React.FC<NavigationNavbarProps> = ({
4144
const permission = item.permission ?? true;
4245
const addDivider = item.addDivider ?? false;
4346

47+
const showOnWeb = item.showOnWeb ?? true;
48+
49+
if (!showOnWeb && isDesktop) {
50+
return null;
51+
}
52+
4453
return (
4554
<React.Fragment key={item.id}>
4655
<MenuItem disabled={!permission} onClick={item.onClick}>

0 commit comments

Comments
 (0)