'use strict';

exports.__esModule = true;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * @category navigation
 * @component breadcrumbs
 * @variations collab-ui-react
 */

var Breadcrumbs = function (_React$PureComponent) {
  (0, _inherits3.default)(Breadcrumbs, _React$PureComponent);

  function Breadcrumbs() {
    (0, _classCallCheck3.default)(this, Breadcrumbs);
    return (0, _possibleConstructorReturn3.default)(this, _React$PureComponent.apply(this, arguments));
  }

  Breadcrumbs.prototype.render = function render() {
    var _props = this.props,
        className = _props.className,
        children = _props.children;


    var items = _react2.default.Children.map(children, function (child, idx) {
      if (children.length - 1 === idx || !children.length) {
        return _react2.default.cloneElement(child, { className: 'current' });
      }

      return child;
    });

    return _react2.default.createElement(
      'ul',
      { className: 'cui-breadcrumbs' + (' ' + className) },
      items
    );
  };

  return Breadcrumbs;
}(_react2.default.PureComponent);

/**
* @name Default Breadcrumbs
* @description Badges are useful.
*
* @category navigation
* @component breadcrumbs
* @section default
*
* @js

import { ListItem } from '@collab-ui/react';

export default function Default() {
    return (
      <div className='row'>
        <div className='columns small-12'>
          <Breadcrumbs>
            <li href='javascript:void(0)'>
              Default
            </li>
          </Breadcrumbs>
        </div>
        <div className='columns small-12'>
          <Breadcrumbs>
            <li href='javascript:void(0)'>
              Default
            </li>
            <li href='javascript:void(0)'>
              Default2
            </li>
          </Breadcrumbs>
        </div>
        <div className='columns small-12'>
          <Breadcrumbs>
            <li href='javascript:void(0)'>
              Default
            </li>
            <li href='javascript:void(0)'>
              Default2
            </li>
            <li href='javascript:void(0)'>
              Default3
            </li>
          </Breadcrumbs>
        </div>
      </div>
    );
  }

**/


Breadcrumbs.displayName = 'Breadcrumbs';
Breadcrumbs.defaultProps = {
  children: null,
  className: ''
};
exports.default = Breadcrumbs;
module.exports = exports['default'];