UNPKG

1.55 kBJavaScriptView Raw
1import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
3import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
4import classNames from 'classnames';
5import React from 'react';
6import PropTypes from 'prop-types';
7import { prefix } from './utils/bootstrapUtils';
8var contextTypes = {
9 $bs_navbar: PropTypes.shape({
10 bsClass: PropTypes.string
11 })
12};
13
14var NavbarBrand =
15/*#__PURE__*/
16function (_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
50NavbarBrand.contextTypes = contextTypes;
51export default NavbarBrand;
\No newline at end of file