{"size": 874, "ext": "js", "max_stars_repo_path": "src/NavbarBrand.js", "max_stars_repo_name": "jottaxwds/react-bootstrap", "max_stars_repo_stars_event_min_datetime": "2018-07-27T18:40:55.000Z", "max_stars_repo_stars_event_max_datetime": "2019-01-02T07:20:13.000Z", "max_issues_repo_path": "src/NavbarBrand.js", "max_issues_repo_name": "jottaxwds/react-bootstrap", "max_issues_repo_issues_event_min_datetime": "2018-07-08T02:29:48.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-08T02:29:48.000Z", "max_forks_repo_path": "src/NavbarBrand.js", "max_forks_repo_name": "jottaxwds/react-bootstrap", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 23.6216216216, "max_line_length": 79, "alphanum_fraction": 0.671624714}
import classNames from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';

import { prefix } from './utils/bootstrapUtils';

const contextTypes = {
  $bs_navbar: PropTypes.shape({
    bsClass: PropTypes.string
  })
};

class NavbarBrand extends React.Component {
  render() {
    const { className, children, ...props } = this.props;
    const navbarProps = this.context.$bs_navbar || { bsClass: 'navbar' };

    const bsClassName = prefix(navbarProps, 'brand');

    if (React.isValidElement(children)) {
      return React.cloneElement(children, {
        className: classNames(children.props.className, className, bsClassName)
      });
    }

    return (
      <span {...props} className={classNames(className, bsClassName)}>
        {children}
      </span>
    );
  }
}

NavbarBrand.contextTypes = contextTypes;

export default NavbarBrand;
