var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { mapToCssModules, tagPropType } from './Shared/helper.js';

var getExpandClass = function getExpandClass(expand) {
  if (expand === false) {
    return false;
  } else if (expand === true || expand === 'xs') {
    return 'navbar-expand';
  }
  return 'navbar-expand-' + expand;
};

//component - CoreUI / CNavbar

var CNavbar = function CNavbar(props) {
  var _classNames;

  var Tag = props.tag,
      className = props.className,
      cssModule = props.cssModule,
      innerRef = props.innerRef,
      expandable = props.expandable,
      light = props.light,
      fixed = props.fixed,
      sticky = props.sticky,
      color = props.color,
      attributes = _objectWithoutProperties(props, ['tag', 'className', 'cssModule', 'innerRef', 'expandable', 'light', 'fixed', 'sticky', 'color']);

  //render

  var classes = mapToCssModules(classNames(className, 'navbar', getExpandClass(expandable), light ? 'navbar-light' : 'navbar-dark', (_classNames = {}, _classNames['bg-' + color] = color, _classNames['fixed-' + fixed] = fixed, _classNames['sticky-' + sticky] = sticky, _classNames)), cssModule);

  return React.createElement(Tag, _extends({}, attributes, { className: classes, ref: innerRef }));
};

CNavbar.propTypes = process.env.NODE_ENV !== "production" ? {
  tag: tagPropType,
  className: PropTypes.string,
  cssModule: PropTypes.object,
  //
  innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
  light: PropTypes.bool,
  color: PropTypes.string,
  fixed: PropTypes.string,
  sticky: PropTypes.string,
  expandable: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
} : {};

CNavbar.defaultProps = {
  tag: 'nav',
  expandable: false
};

export default CNavbar;