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

import './item.scss';

const Item = ({ className, component, isLastChild, variant, ...rest }) => {
  const Comp = component;
  return (
    <Comp
      className={className}
      styleName={classNames('base', variant, {
        lastItem: isLastChild
      })}
      {...rest}
    />
  );
};

Item.propTypes = {
  /** @ignore */
  className: PropTypes.string,
  component: PropTypes.node,
  isLastChild: PropTypes.bool,
  variant: PropTypes.string
};

Item.defaultProps = {
  className: undefined,
  component: 'a',
  isLastChild: false,
  variant: 'primary'
};

Item.componentName = 'BreadCrumbItem';

export default Item;
