UNPKG

@bigfishtv/cockpit

Version:

66 lines (53 loc) 2.67 kB
var _class, _temp; function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } import PropTypes from 'prop-types'; import React, { Component } from 'react'; import Button from '../button/Button'; import BreadcrumbTrail from '../breadcrumb/BreadcrumbTrail'; import { renderComponent } from '../../utils/componentUtils'; var DefaultToolbar = function DefaultToolbar(props) { return React.createElement(Button, { type: 'submit', text: 'Save', style: 'secondary', size: 'large', onClick: props.onSave }); }; var Bulkhead = (_temp = _class = function (_Component) { _inherits(Bulkhead, _Component); function Bulkhead() { _classCallCheck(this, Bulkhead); return _possibleConstructorReturn(this, _Component.apply(this, arguments)); } Bulkhead.prototype.render = function render() { var _props = this.props, title = _props.title, Toolbar = _props.Toolbar, props = _objectWithoutProperties(_props, ['title', 'Toolbar']); return React.createElement( 'div', { className: 'bulkhead flex' }, React.createElement( 'div', { className: 'bulkhead-left' }, React.createElement( 'h1', { className: 'bulkhead-title' }, title ), React.createElement(BreadcrumbTrail, null) ), React.createElement( 'div', { className: 'bulkhead-right' }, renderComponent(Toolbar, props) ) ); }; return Bulkhead; }(Component), _class.propTypes = { title: PropTypes.node, Toolbar: PropTypes.oneOfType([PropTypes.func, PropTypes.node]) }, _class.defaultProps = { title: 'Untitled', Toolbar: DefaultToolbar }, _temp); export { Bulkhead as default };