Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid container width is more than page width #8011

Closed
mehrdad-shokri opened this issue Sep 2, 2017 · 1 comment
Closed

Grid container width is more than page width #8011

mehrdad-shokri opened this issue Sep 2, 2017 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@mehrdad-shokri
Copy link

Problem description

When Adding a Grid component at the root of a component I notice that class MuiGrid-spacing-xs-16-470 is appended to the root element.
it's width is set to calc(100% + 16px); witch is obviously 16px more than page width.
Is this a bug or I'm missing sth?

import React, { Component } from 'react';
import { Route } from 'react-router-dom';
import PropTypes from 'prop-types';
import Header from '../common/Header/Header';
import Sidebar from '../common/Sidebar/Sidebar';
import Grid from 'material-ui/Grid';

class Template extends Component {
    constructor() {
    super();
    this.state = { isDrawerOpen: false };
    this.toggleDrawer = this.toggleDrawer.bind(this);
    this.closeDrawer = this.closeDrawer.bind(this);
    this.setDrawerState = this.setDrawerState.bind(this);
   }

  setDrawerState(state) {
     this.setState({ isDrawerOpen: state });
  }

   toggleDrawer() {
     this.setDrawerState(!this.state.isDrawerOpen);
    }

   closeDrawer() {
      this.setDrawerState(false);
    }

   render() {
      const { component, ...rest } = this.props;
      return (
        <Route
           {...rest}
         render={() => (
          <div>
          <Header
            onDrawerButtonClicked={this.toggleDrawer}
          />
          <Sidebar
               open={this.state.isDrawerOpen}
               onRequestClose={this.closeDrawer}
         />
           <Grid container>
              {component}
            </Grid>
          </div>
        )}
      />
     );
   }
   }
   Template.propTypes = {
    component: PropTypes.element.isRequired,
  };

    export default Template;

Versions

  • Material-UI: 1.0.0-beta7
  • React: ^15.6.1
  • Browser: Chrome 60
@oliviertassinari
Copy link
Member

We also set margin: -16px to compensate.

Duplicate of #7466

@oliviertassinari oliviertassinari added the duplicate This issue or pull request already exists label Sep 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants