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