Skip to content

Commit 8ae3eb6

Browse files
fix small media issue (#56)
* fix small media issue * fixed sidebar for small devices * Update package.json --------- Co-authored-by: CodedThemes <[email protected]>
1 parent 7e255ec commit 8ae3eb6

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "berry-material-react-free",
3-
"version": "3.3.0",
3+
"version": "3.3.1",
44
"private": true,
55
"homepage": "https://berrydashboard.io/free",
66
"dependencies": {

src/layout/MainLayout/index.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useEffect } from 'react';
21
import { useDispatch, useSelector } from 'react-redux';
32
import { Outlet } from 'react-router-dom';
43

@@ -66,20 +65,14 @@ const Main = styled('main', { shouldForwardProp: (prop) => prop !== 'open' })(({
6665

6766
const MainLayout = () => {
6867
const theme = useTheme();
69-
const matchDownMd = useMediaQuery(theme.breakpoints.down('lg'));
70-
68+
const matchDownMd = useMediaQuery(theme.breakpoints.down('md'));
7169
// Handle left drawer
7270
const leftDrawerOpened = useSelector((state) => state.customization.opened);
7371
const dispatch = useDispatch();
7472
const handleLeftDrawerToggle = () => {
7573
dispatch({ type: SET_MENU, opened: !leftDrawerOpened });
7674
};
7775

78-
useEffect(() => {
79-
dispatch({ type: SET_MENU, opened: !matchDownMd });
80-
// eslint-disable-next-line react-hooks/exhaustive-deps
81-
}, [matchDownMd]);
82-
8376
return (
8477
<Box sx={{ display: 'flex' }}>
8578
<CssBaseline />
@@ -100,7 +93,7 @@ const MainLayout = () => {
10093
</AppBar>
10194

10295
{/* drawer */}
103-
<Sidebar drawerOpen={leftDrawerOpened} drawerToggle={handleLeftDrawerToggle} />
96+
<Sidebar drawerOpen={!matchDownMd ? leftDrawerOpened : !leftDrawerOpened} drawerToggle={handleLeftDrawerToggle} />
10497

10598
{/* main content */}
10699
<Main theme={theme} open={leftDrawerOpened}>

src/ui-component/cards/MainCard.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ const MainCard = forwardRef(
4646
}}
4747
>
4848
{/* card header and action */}
49-
{title &&
50-
( <CardHeader sx={headerSX} title={ darkTitle? <Typography variant="h3">{title}</Typography> : title } action={secondary} /> )
51-
}
49+
{title && (
50+
<CardHeader
51+
sx={headerSX}
52+
title={darkTitle ? <Typography variant="h3">{title}</Typography> : title}
53+
action={secondary}
54+
/>
55+
)}
5256

5357
{/* content & header divider */}
5458
{title && <Divider />}

0 commit comments

Comments
 (0)