1
1
import ExpandLessIcon from '@mui/icons-material/ExpandLess' ;
2
2
import ExpandMoreIcon from '@mui/icons-material/ExpandMore' ;
3
- import { ListItemTextProps , MenuListProps } from '@mui/material' ;
3
+ import { ListItemTextProps , MenuListProps , useMediaQuery , useTheme } from '@mui/material' ;
4
4
import React , { MouseEvent , useState } from 'react' ;
5
5
import { Collapse , Divider , ListItemText , MenuItem } from '../../base' ;
6
6
import { IconWrapper , MenuItemList , MenuItemSubList , MenuListStyle , SubIconWrapper } from './style' ;
@@ -13,6 +13,7 @@ type NavigationItem = {
13
13
onClick : ( ) => void ;
14
14
subItems ?: NavigationItem [ ] ;
15
15
addDivider ?: boolean ;
16
+ showOnWeb ?: boolean ;
16
17
} ;
17
18
18
19
interface NavigationNavbarProps {
@@ -26,6 +27,8 @@ const NavigationNavbar: React.FC<NavigationNavbarProps> = ({
26
27
MenuListProps = { } ,
27
28
ListItemTextProps = { }
28
29
} ) => {
30
+ const theme = useTheme ( ) ;
31
+ const isDesktop = useMediaQuery ( theme . breakpoints . up ( 'sm' ) ) ;
29
32
const [ openSectionId , setOpenSectionId ] = useState < string | null > ( null ) ;
30
33
const toggleSectionOpen = ( sectionId : string , event : MouseEvent < SVGSVGElement > ) => {
31
34
event . stopPropagation ( ) ;
@@ -41,6 +44,12 @@ const NavigationNavbar: React.FC<NavigationNavbarProps> = ({
41
44
const permission = item . permission ?? true ;
42
45
const addDivider = item . addDivider ?? false ;
43
46
47
+ const showOnWeb = item . showOnWeb ?? true ;
48
+
49
+ if ( ! showOnWeb && isDesktop ) {
50
+ return null ;
51
+ }
52
+
44
53
return (
45
54
< React . Fragment key = { item . id } >
46
55
< MenuItem disabled = { ! permission } onClick = { item . onClick } >
0 commit comments