import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _createClass from 'babel-runtime/helpers/createClass';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
var _jsxFileName = 'src/breadcrumb/BreadcrumbItem.jsx';
/**
 * BreadcrumbItem.jsx
 *
 * @Author: zhangce
 * @Date: 18/1/23 下午2:44
 */

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

/**
 * BreadcrumbItem
 * */

var BreadcrumbItem = function (_React$PureComponent) {
    _inherits(BreadcrumbItem, _React$PureComponent);

    function BreadcrumbItem() {
        _classCallCheck(this, BreadcrumbItem);

        return _possibleConstructorReturn(this, (BreadcrumbItem.__proto__ || Object.getPrototypeOf(BreadcrumbItem)).apply(this, arguments));
    }

    _createClass(BreadcrumbItem, [{
        key: 'render',
        value: function render() {
            var _props = this.props,
                prefixCls = _props.prefixCls,
                className = _props.className,
                separator = _props.separator,
                href = _props.href,
                children = _props.children,
                other = _objectWithoutProperties(_props, ['prefixCls', 'className', 'separator', 'href', 'children']);

            var classStr = classNames(prefixCls, className);

            var link = 'href' in this.props ? React.createElement(
                'a',
                Object.assign({ href: href, className: prefixCls + '-inner' }, other, {
                    __source: {
                        fileName: _jsxFileName,
                        lineNumber: 45
                    },
                    __self: this
                }),
                children
            ) : React.createElement(
                'span',
                Object.assign({ className: prefixCls + '-inner' }, other, {
                    __source: {
                        fileName: _jsxFileName,
                        lineNumber: 49
                    },
                    __self: this
                }),
                children
            );

            return React.createElement(
                'span',
                { className: classStr, __source: {
                        fileName: _jsxFileName,
                        lineNumber: 55
                    },
                    __self: this
                },
                link,
                React.createElement(
                    'span',
                    { className: prefixCls + '-separator', __source: {
                            fileName: _jsxFileName,
                            lineNumber: 57
                        },
                        __self: this
                    },
                    separator
                )
            );
        }
    }]);

    return BreadcrumbItem;
}(React.PureComponent);

BreadcrumbItem.propTypes = {
    /**
     * 类前缀
     * */
    prefixCls: PropTypes.string,
    /**
     * 类名
     * */
    className: PropTypes.string,
    /**
     * 分隔符
     * */
    separator: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
    /**
     * 跳转链接
     * */
    href: PropTypes.string
};
BreadcrumbItem.defaultProps = {
    prefixCls: 'ne-breadcrumb-item'
};


export default BreadcrumbItem;