material-ui
material-ui copied to clipboard
Docked Drawer hides content and Appbar, and does not wrap them
Problem description
I think that a docked drawer should be wrapping main content, and not hiding it. For example, with a docked and opened drawer, my navbar button is hidden, and i can't close it.
I use react-bootstrap for its grid system.
Link to minimally-working code that reproduces the issue
App.js
import React from 'react';
import 'bootstrap/dist/css/bootstrap.css';
import '../style/style.css';
import {muiTheme} from '../style/styles.js';
import AppBar from "material-ui/AppBar";
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import JumboHeader from './JumboHeader'
import SideDrawer from './SideDrawer'
import MenuItem from 'material-ui/MenuItem';
import {Grid, Row, Col} from 'react-bootstrap'
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
drawerOpen: true
};
this.switchDrawer = this.switchDrawer.bind(this);
}
switchDrawer() {
this.setState({
drawerOpen: !this.state.drawerOpen
})
}
render() {
return (
<MuiThemeProvider muiTheme={muiTheme}>
<div>
<AppBar
onLeftIconButtonTouchTap={this.switchDrawer}
title="Menu"
/>
<SideDrawer drawerOpen={this.state.drawerOpen} switchDrawer={this.switchDrawer} />
<Grid fluid={true}>
<Row>
<JumboHeader />
</Row>
</Grid>
<Grid>
<Row>
<p>Lorem ipsum</p>
</Row>
</Grid>
</div>
</MuiThemeProvider>
)
}
}
export default App;
SideDrawer.js
import React from 'react'
import Drawer from 'material-ui/Drawer'
import List from 'material-ui/List'
import Subheader from 'material-ui/Subheader'
import ListItem from 'material-ui/List'
import ContentInbox from 'material-ui/svg-icons/content/inbox';
import ActionGrade from 'material-ui/svg-icons/action/grade';
import ContentSend from 'material-ui/svg-icons/content/send';
import ContentDrafts from 'material-ui/svg-icons/content/drafts';
class SideDrawer extends React.Component {
constructor(props) {
super(props);
this.state = {
drawerOpen: true
};
this.switchDrawer = this.switchDrawer.bind(this);
}
switchDrawer() {
this.setState({
drawerOpen: !this.state.drawerOpen
})
}
render() {
return (
<Drawer
docked={true}
open={this.props.drawerOpen}
onRequestChange={this.props.switchDrawer}
>
<List>
<Subheader>The MENU</Subheader>
</List>
</Drawer>
);
}
}
export default SideDrawer;
Versions
- Material-UI: 0.17.1
- React: "16.0.0-alpha.6
- Browser: google-chrome Windows 56.0.2924.87
This far, I only found a little hack to "squeeze" the main container, but it's just a hack, thanks to Jeff McCloud : https://stackoverflow.com/questions/40620302/how-to-get-material-ui-drawer-to-squeeze-other-content-when-open
had trouble with this as well
Makes me wonder how the guys from admin on rest did that behavior...