import _snakeCase from "lodash/fp/snakeCase";
import React from 'react';
import PropTypes from 'prop-types';
import Link from '../../atom/link';
import { hoverFill } from '../../atom/button/hover-fill.css';
import style from './style.css';
const buildBreadcrumbs = (breadcrumb, index) => {
  const {
    title,
    href
  } = breadcrumb;
  if (!href) {
    return /*#__PURE__*/React.createElement("div", {
      className: style.breadcrumb,
      key: index
    }, /*#__PURE__*/React.createElement("span", null, title));
  }
  return /*#__PURE__*/React.createElement("div", {
    className: style.breadcrumb,
    key: index
  }, /*#__PURE__*/React.createElement(Link, {
    href: href
  }, title));
};
const buildLink = (link, index) => {
  const {
    title,
    href,
    type
  } = link;
  const className = type === 'primary' ? style.primary : style.secondary;
  return /*#__PURE__*/React.createElement("div", {
    className: className,
    key: index
  }, /*#__PURE__*/React.createElement(Link, {
    "data-name": `${_snakeCase(title)}_link`,
    className: hoverFill,
    target: "_blank",
    href: href
  }, title));
};
const Breadcrumbs = props => {
  const {
    breadcrumbs,
    links = []
  } = props;
  const breadcrumbsList = breadcrumbs.map(buildBreadcrumbs);
  const linksList = links.map(buildLink);
  return /*#__PURE__*/React.createElement("div", {
    className: style.wrapper
  }, /*#__PURE__*/React.createElement("div", null, breadcrumbsList), /*#__PURE__*/React.createElement("div", null, linksList));
};
Breadcrumbs.propTypes = process.env.NODE_ENV !== "production" ? {
  breadcrumbs: PropTypes.arrayOf(PropTypes.shape({
    title: PropTypes.string.isRequired,
    href: PropTypes.string
  })),
  links: PropTypes.arrayOf(PropTypes.shape({
    title: Link.propTypes.children,
    href: Link.propTypes.href,
    type: PropTypes.string
  }))
} : {};
export default Breadcrumbs;
//# sourceMappingURL=index.js.map