134 lines
4.0 KiB
JavaScript
134 lines
4.0 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = exports.styles = void 0;
|
|
|
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
|
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
|
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
|
|
var _react = _interopRequireDefault(require("react"));
|
|
|
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
|
var _withStyles = _interopRequireDefault(require("../styles/withStyles"));
|
|
|
|
var _helpers = require("../utils/helpers");
|
|
|
|
var _Paper = _interopRequireDefault(require("../Paper"));
|
|
|
|
// @inheritedComponent Paper
|
|
var styles = function styles(theme) {
|
|
var backgroundColorDefault = theme.palette.type === 'light' ? theme.palette.grey[100] : theme.palette.grey[900];
|
|
return {
|
|
root: {
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
width: '100%',
|
|
boxSizing: 'border-box',
|
|
// Prevent padding issue with the Modal and fixed positioned AppBar.
|
|
zIndex: theme.zIndex.appBar,
|
|
flexShrink: 0
|
|
},
|
|
positionFixed: {
|
|
position: 'fixed',
|
|
top: 0,
|
|
left: 'auto',
|
|
right: 0
|
|
},
|
|
positionAbsolute: {
|
|
position: 'absolute',
|
|
top: 0,
|
|
left: 'auto',
|
|
right: 0
|
|
},
|
|
positionSticky: {
|
|
position: 'sticky',
|
|
top: 0,
|
|
left: 'auto',
|
|
right: 0
|
|
},
|
|
positionStatic: {
|
|
position: 'static'
|
|
},
|
|
colorDefault: {
|
|
backgroundColor: backgroundColorDefault,
|
|
color: theme.palette.getContrastText(backgroundColorDefault)
|
|
},
|
|
colorPrimary: {
|
|
backgroundColor: theme.palette.primary.main,
|
|
color: theme.palette.primary.contrastText
|
|
},
|
|
colorSecondary: {
|
|
backgroundColor: theme.palette.secondary.main,
|
|
color: theme.palette.secondary.contrastText
|
|
}
|
|
};
|
|
};
|
|
|
|
exports.styles = styles;
|
|
|
|
function AppBar(props) {
|
|
var _classNames;
|
|
|
|
var children = props.children,
|
|
classes = props.classes,
|
|
classNameProp = props.className,
|
|
color = props.color,
|
|
position = props.position,
|
|
other = (0, _objectWithoutProperties2.default)(props, ["children", "classes", "className", "color", "position"]);
|
|
var className = (0, _classnames.default)(classes.root, classes["position".concat((0, _helpers.capitalize)(position))], (_classNames = {}, (0, _defineProperty2.default)(_classNames, classes["color".concat((0, _helpers.capitalize)(color))], color !== 'inherit'), (0, _defineProperty2.default)(_classNames, 'mui-fixed', position === 'fixed'), _classNames), classNameProp);
|
|
return _react.default.createElement(_Paper.default, (0, _extends2.default)({
|
|
square: true,
|
|
component: "header",
|
|
elevation: 4,
|
|
className: className
|
|
}, other), children);
|
|
}
|
|
|
|
AppBar.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
/**
|
|
* The content of the component.
|
|
*/
|
|
children: _propTypes.default.node.isRequired,
|
|
|
|
/**
|
|
* Useful to extend the style applied to components.
|
|
*/
|
|
classes: _propTypes.default.object.isRequired,
|
|
|
|
/**
|
|
* @ignore
|
|
*/
|
|
className: _propTypes.default.string,
|
|
|
|
/**
|
|
* The color of the component. It supports those theme colors that make sense for this component.
|
|
*/
|
|
color: _propTypes.default.oneOf(['inherit', 'primary', 'secondary', 'default']),
|
|
|
|
/**
|
|
* The positioning type. The behavior of the different options is described
|
|
* [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning).
|
|
* Note: `sticky` is not universally supported and will fall back to `static` when unavailable.
|
|
*/
|
|
position: _propTypes.default.oneOf(['fixed', 'absolute', 'sticky', 'static'])
|
|
} : {};
|
|
AppBar.defaultProps = {
|
|
color: 'primary',
|
|
position: 'fixed'
|
|
};
|
|
|
|
var _default = (0, _withStyles.default)(styles, {
|
|
name: 'MuiAppBar'
|
|
})(AppBar);
|
|
|
|
exports.default = _default; |