144 lines
4.2 KiB
JavaScript
144 lines
4.2 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.styles = undefined;
|
|
|
|
var _extends2 = require('babel-runtime/helpers/extends');
|
|
|
|
var _extends3 = _interopRequireDefault(_extends2);
|
|
|
|
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
|
|
|
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
|
|
|
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
|
|
|
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
|
|
|
var _react = require('react');
|
|
|
|
var _react2 = _interopRequireDefault(_react);
|
|
|
|
var _propTypes = require('prop-types');
|
|
|
|
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
|
|
var _classnames = require('classnames');
|
|
|
|
var _classnames2 = _interopRequireDefault(_classnames);
|
|
|
|
var _withStyles = require('../styles/withStyles');
|
|
|
|
var _withStyles2 = _interopRequireDefault(_withStyles);
|
|
|
|
var _helpers = require('../utils/helpers');
|
|
|
|
var _Paper = require('../Paper');
|
|
|
|
var _Paper2 = _interopRequireDefault(_Paper);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
// @inheritedComponent Paper
|
|
|
|
var styles = exports.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
|
|
}
|
|
};
|
|
};
|
|
|
|
function AppBar(props) {
|
|
var _classNames;
|
|
|
|
var children = props.children,
|
|
classes = props.classes,
|
|
classNameProp = props.className,
|
|
color = props.color,
|
|
position = props.position,
|
|
other = (0, _objectWithoutProperties3.default)(props, ['children', 'classes', 'className', 'color', 'position']);
|
|
|
|
|
|
var className = (0, _classnames2.default)(classes.root, classes['position' + (0, _helpers.capitalize)(position)], (_classNames = {}, (0, _defineProperty3.default)(_classNames, classes['color' + (0, _helpers.capitalize)(color)], color !== 'inherit'), (0, _defineProperty3.default)(_classNames, 'mui-fixed', position === 'fixed'), _classNames), classNameProp);
|
|
|
|
return _react2.default.createElement(
|
|
_Paper2.default,
|
|
(0, _extends3.default)({ square: true, component: 'header', elevation: 4, className: className }, other),
|
|
children
|
|
);
|
|
}
|
|
|
|
AppBar.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
/**
|
|
* The content of the component.
|
|
*/
|
|
children: _propTypes2.default.node.isRequired,
|
|
/**
|
|
* Useful to extend the style applied to components.
|
|
*/
|
|
classes: _propTypes2.default.object.isRequired,
|
|
/**
|
|
* @ignore
|
|
*/
|
|
className: _propTypes2.default.string,
|
|
/**
|
|
* The color of the component. It supports those theme colors that make sense for this component.
|
|
*/
|
|
color: _propTypes2.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: _propTypes2.default.oneOf(['fixed', 'absolute', 'sticky', 'static'])
|
|
} : {};
|
|
|
|
AppBar.defaultProps = {
|
|
color: 'primary',
|
|
position: 'fixed'
|
|
};
|
|
|
|
exports.default = (0, _withStyles2.default)(styles, { name: 'MuiAppBar' })(AppBar); |