1 | import React from 'react';
|
2 | import classnames from 'classnames';
|
3 |
|
4 |
|
5 | const defaultProps = {
|
6 | clsPrefix : "u-navbar-brand"
|
7 | }
|
8 |
|
9 | class 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 |
|
29 | NavbarBrand.defaultProps = defaultProps;
|
30 |
|
31 | export default NavbarBrand;
|