1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
4 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
5 | import _inherits from 'babel-runtime/helpers/inherits';
|
6 | import classNames from 'classnames';
|
7 | import React from 'react';
|
8 | import PropTypes from 'prop-types';
|
9 |
|
10 | import { prefix } from './utils/bootstrapUtils';
|
11 |
|
12 | var contextTypes = {
|
13 | $bs_navbar: PropTypes.shape({
|
14 | bsClass: PropTypes.string
|
15 | })
|
16 | };
|
17 |
|
18 | var NavbarBrand = function (_React$Component) {
|
19 | _inherits(NavbarBrand, _React$Component);
|
20 |
|
21 | function NavbarBrand() {
|
22 | _classCallCheck(this, NavbarBrand);
|
23 |
|
24 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
25 | }
|
26 |
|
27 | NavbarBrand.prototype.render = function render() {
|
28 | var _props = this.props,
|
29 | className = _props.className,
|
30 | children = _props.children,
|
31 | props = _objectWithoutProperties(_props, ['className', 'children']);
|
32 |
|
33 | var navbarProps = this.context.$bs_navbar || { bsClass: 'navbar' };
|
34 |
|
35 | var bsClassName = prefix(navbarProps, 'brand');
|
36 |
|
37 | if (React.isValidElement(children)) {
|
38 | return React.cloneElement(children, {
|
39 | className: classNames(children.props.className, className, bsClassName)
|
40 | });
|
41 | }
|
42 |
|
43 | return React.createElement(
|
44 | 'span',
|
45 | _extends({}, props, { className: classNames(className, bsClassName) }),
|
46 | children
|
47 | );
|
48 | };
|
49 |
|
50 | return NavbarBrand;
|
51 | }(React.Component);
|
52 |
|
53 | NavbarBrand.contextTypes = contextTypes;
|
54 |
|
55 | export default NavbarBrand; |
\ | No newline at end of file |