UNPKG

@material-ui/core

Version:

React components that implement Google's Material Design.

85 lines (76 loc) 2.34 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; import withStyles from '../styles/withStyles'; export const styles = theme => ({ /* Styles applied to the root element. */ root: { position: 'relative', display: 'flex', alignItems: 'center' }, /* Styles applied to the root element if `disableGutters={false}`. */ gutters: { paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2), [theme.breakpoints.up('sm')]: { paddingLeft: theme.spacing(3), paddingRight: theme.spacing(3) } }, /* Styles applied to the root element if `variant="regular"`. */ regular: theme.mixins.toolbar, /* Styles applied to the root element if `variant="dense"`. */ dense: { minHeight: 48 } }); const Toolbar = /*#__PURE__*/React.forwardRef(function Toolbar(props, ref) { const { classes, className, component: Component = 'div', disableGutters = false, variant = 'regular' } = props, other = _objectWithoutPropertiesLoose(props, ["classes", "className", "component", "disableGutters", "variant"]); return /*#__PURE__*/React.createElement(Component, _extends({ className: clsx(classes.root, classes[variant], className, !disableGutters && classes.gutters), ref: ref }, other)); }); process.env.NODE_ENV !== "production" ? Toolbar.propTypes = { /** * Toolbar children, usually a mixture of `IconButton`, `Button` and `Typography`. */ children: PropTypes.node, /** * 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 HTML element or a component. */ component: PropTypes /* @typescript-to-proptypes-ignore */ .elementType, /** * If `true`, disables gutter padding. */ disableGutters: PropTypes.bool, /** * The variant to use. */ variant: PropTypes.oneOf(['regular', 'dense']) } : void 0; export default withStyles(styles, { name: 'MuiToolbar' })(Toolbar);