forked from alii13/whatsapp-clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrawerPhone.js
96 lines (84 loc) · 2.47 KB
/
DrawerPhone.js
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import React from 'react';
import Drawer from '@material-ui/core/Drawer';
import Hidden from '@material-ui/core/Hidden';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';
import Toolbar from '@material-ui/core/Toolbar';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import SidebarChatList from './SidebarChatList';
import "./DrawerPhone.css"
const drawerWidth = 240;
const useStyles = makeStyles((theme) => ({
drawer: {
[theme.breakpoints.up('sm')]: {
width: drawerWidth,
flexShrink: 0,
},
},
menuButton: {
marginRight: theme.spacing(2),
[theme.breakpoints.up('sm')]: {
display: 'none',
},
},
// necessary for content to be below app bar
toolbar: theme.mixins.toolbar,
drawerPaper: {
width: drawerWidth,
}
}));
function DrawerPhone(props) {
const { window } = props;
const {rooms}=props;
console.log(props);
const classes = useStyles();
const theme = useTheme();
const [mobileOpen, setMobileOpen] = React.useState(false);
const handleDrawerToggle = () => {
setMobileOpen(!mobileOpen);
console.log(rooms);
};
const drawer = (
<div>
<div className={classes.toolbar} />
<div>
{(rooms!==undefined)?<SidebarChatList rooms={rooms} dr="yes"/>:null}
</div>
{/* <SidebarChatList rooms={rooms}/> */}
</div>
);
const container = window !== undefined ? () => window().document.body : undefined;
return (
<div className="drawer__phone">
<Toolbar>
<IconButton
color="inherit"
aria-label="open drawer"
edge="start"
onClick={handleDrawerToggle}
className={classes.menuButton}
>
<MenuIcon />
</IconButton>
</Toolbar>
<Hidden smUp implementation="css">
<Drawer
container={container}
variant="temporary"
anchor={theme.direction === 'rtl' ? 'right' : 'left'}
open={mobileOpen}
onClose={handleDrawerToggle}
classes={{
paper: classes.drawerPaper,
}}
ModalProps={{
keepMounted: true, // Better open performance on mobile.
}}
>
{drawer}
</Drawer>
</Hidden>
</div>
)
}
export default DrawerPhone