/
MobileControls.tsx
82 lines (77 loc) · 2.46 KB
/
MobileControls.tsx
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import {Box, Grid, Icon, Paper, styled} from "@mui/material";
import ControlsBody from "./ControlsBody";
import {ReactComponent as Logo} from "../assets/icons/valetudo_logo_with_name.svg";
import {ExpandLess as OpenIcon, ExpandMore as CloseIcon,} from "@mui/icons-material";
import React from "react";
const MobileControls: React.FunctionComponent<{ open: boolean, setOpen: (newOpen: boolean) => void }> = ({
open,
setOpen
}): JSX.Element => {
const StyledIcon = styled(Icon)(({theme}) => {
return {
fontSize: "2.5em"
};
});
const ControlsSheetContainer = styled(Box)(({ theme }) => {
const color = theme.palette.mode === "light" ? "#ededed" : "#242424";
return {
backgroundColor: color,
borderColor: color,
borderTopWidth: "4px",
borderLeftWidth: "1px",
borderRightWidth: "1px",
borderBottomWidth: "1px",
borderStyle: "solid",
borderTopLeftRadius: "4px",
borderTopRightRadius: "4px",
paddingTop: "0.125rem",
};
});
return (
<Paper sx={{
height: "100%"
}}>
<ControlsSheetContainer
style={{
display: open ? "" : "none",
height: "calc(95% - 68px)",
}}
>
<Box p={1} sx={{
overflow: open ? "scroll" : "hidden",
height: "100%",
}}>
<ControlsBody />
</Box>
</ControlsSheetContainer>
<Grid
container
direction="row"
sx={{
height: "68px"
}}
onClick={() => {
setOpen(!open);
}}
>
<Grid item>
<Box px={2} pt={2} pb={1}>
<Logo
style={{}}
width={200}
height={36}
/>
</Box>
</Grid>
<Grid item sx={{
marginLeft: "auto"
}}>
<Box px={2} pt={2} pb={1}>
<StyledIcon as={open ? CloseIcon : OpenIcon}/>
</Box>
</Grid>
</Grid>
</Paper>
);
};
export default MobileControls;