-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathConfiguratorRoot.jsx
More file actions
60 lines (50 loc) · 1.7 KB
/
ConfiguratorRoot.jsx
File metadata and controls
60 lines (50 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
=========================================================
* Material Dashboard 2 React - v2.2.0
=========================================================
* Product Page: https://www.creative-tim.com/product/material-dashboard-react
* Copyright 2023 Creative Tim (https://www.creative-tim.com)
Coded by www.creative-tim.com
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
// @mui material components
import Drawer from "@mui/material/Drawer";
import { styled } from "@mui/material/styles";
export default styled(Drawer)(({ theme, ownerState }) => {
const { boxShadows, functions, transitions } = theme;
const { openConfigurator } = ownerState;
const configuratorWidth = 360;
const { lg } = boxShadows;
const { pxToRem } = functions;
// drawer styles when openConfigurator={true}
const drawerOpenStyles = () => ({
width: configuratorWidth,
left: "initial",
right: 0,
transition: transitions.create("right", {
easing: transitions.easing.sharp,
duration: transitions.duration.short,
}),
});
// drawer styles when openConfigurator={false}
const drawerCloseStyles = () => ({
left: "initial",
right: pxToRem(-350),
transition: transitions.create("all", {
easing: transitions.easing.sharp,
duration: transitions.duration.short,
}),
});
return {
"& .MuiDrawer-paper": {
height: "100vh",
margin: 0,
padding: `0 ${pxToRem(10)}`,
borderRadius: 0,
boxShadow: lg,
overflowY: "auto",
...(openConfigurator ? drawerOpenStyles() : drawerCloseStyles()),
},
};
});