content: import React from 'react';
  import PropTypes from 'prop-types';
  import clsx from 'clsx';
  import { withStyles } from '../styles';
  import { capitalize } from '../utils';
  
  export const styles = theme => ({
    root: {
      width: '100%',
      marginLeft: 'auto',
      boxSizing: 'border-box',
      marginRight: 'auto',
      paddingLeft: theme.spacing(2),
      paddingRight: theme.spacing(2),
      [theme.breakpoints.up('sm')]: {
        paddingLeft: theme.spacing(3),
        paddingRight: theme.spacing(3),
      },
      [theme.breakpoints.up('md')]: {
        paddingLeft: theme.spacing(4),
        paddingRight: theme.spacing(4),
      },
    },
    fixed: Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
      const value = theme.breakpoints.values[breakpoint];
  
      if (value !== 0) {
        acc[theme.breakpoints.up(breakpoint)] = {
          maxWidth: value,
        };
      }
      return acc;
    }, {}),
    maxWidthXs: {
      [theme.breakpoints.up('xs')]: {
        maxWidth: Math.max(theme.breakpoints.values.xs, 444),
      },
    },
    maxWidthSm: {
      [theme.breakpoints.up('sm')]: {
        maxWidth: theme.breakpoints.values.sm,
      },
    },
    maxWidthMd: {
      [theme.breakpoints.up('md')]: {
        maxWidth: theme.breakpoints.values.md,
      },
    },
    maxWidthLg: {
      [theme.breakpoints.up('lg')]: {
        maxWidth: theme.breakpoints.values.lg,
      },
    },
    maxWidthXl: {
      [theme.breakpoints.up('xl')]: {
        maxWidth: theme.breakpoints.values.xl,
      },
    },
  });
  
  const Container = React.forwardRef(function Container(props, ref) {
    const {
      classes,
      className,
      component: Component = 'div',
      fixed = false,
      maxWidth = 'lg',
      ...other
    } = props;
  
    return (
      <Component
        className={clsx(
          classes.root,
          {
            [classes.fixed]: fixed,
            [classes[`maxWidth${capitalize(String(maxWidth))}`]]: maxWidth !== false,
          },
          className,
        )}
        ref={ref}
        {...other}
      />
    );
  });
  
  Container.propTypes = {
    children: PropTypes.node.isRequired,
    /**
     * Override or extend the styles applied to the component.
     * See [CSS API](#css) below for more details.
     */
    classes: PropTypes.object.isRequired,
    /**
     * @ignore
     */
    className: PropTypes.string,
    /**
     * The component used for the root node.
     * Either a string to use a DOM element or a component.
     */
    component: PropTypes.elementType,
    /**
     * Set the max-width to match the min-width of the current breakpoint.
     * This is useful if you'd prefer to design for a fixed set of sizes
     * instead of trying to accommodate a fully fluid viewport.
     * It's fluid by default.
     */
    fixed: PropTypes.bool,
    /**
     * Determine the max-width of the container.
     * The container width grows with the size of the screen.
     * Set to `false` to disable `maxWidth`.
     */
    maxWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]),
  };
  
  export default withStyles(styles, { name: 'MuiContainer' })(Container);
  