UNPKG

650 BJavaScriptView Raw
1import React from 'react';
2import classnames from 'classnames';
3
4
5const defaultProps = {
6 clsPrefix : "u-navbar-brand"
7}
8
9class NavbarBrand extends React.Component {
10 render() {
11 const { className, children,clsPrefix, ...props } = this.props;
12
13 if (React.isValidElement(children)) {
14 return React.cloneElement(children, {
15 className: classnames(
16 children.props.className, className, clsPrefix
17 )
18 });
19 }
20
21 return (
22 <span {...props} className={classnames(className, clsPrefix)}>
23 {children}
24 </span>
25 );
26 }
27}
28
29NavbarBrand.defaultProps = defaultProps;
30
31export default NavbarBrand;