import _isEmpty from "lodash/fp/isEmpty";
import React from 'react';
import PropTypes from 'prop-types';
import { NovaCompositionCoorpacademyCoorpApp as CoorpAppLogo, NovaCompositionCoorpacademyCoorpLogo as CoorpLogo } from '@coorpacademy/nova-icons';
import Link from '../../atom/link';
import SocialLink from '../../atom/social-link';
import Picture from '../../atom/picture';
import style from './style.css';
const socialLinksTypes = process.env.NODE_ENV !== "production" ? ['facebook', 'twitter', 'linkedin', 'youtube', 'instagram'] : {};
const StoresLinks = ({
  onAppStoreButtonClick,
  appStoreButtonImageUrl,
  playStoreButtonImageUrl,
  onPlayStoreButtonClick,
  'android-alt': androidAlt,
  'ios-alt': iosAlt
}) => /*#__PURE__*/React.createElement("div", {
  className: style.storeLinksContainer
}, /*#__PURE__*/React.createElement(Picture, {
  className: style.imgApple,
  src: appStoreButtonImageUrl,
  onClick: onAppStoreButtonClick,
  alt: iosAlt
}), /*#__PURE__*/React.createElement(Picture, {
  className: style.img,
  src: playStoreButtonImageUrl,
  onClick: onPlayStoreButtonClick,
  alt: androidAlt
}));
StoresLinks.propTypes = process.env.NODE_ENV !== "production" ? {
  onAppStoreButtonClick: PropTypes.func,
  appStoreButtonImageUrl: PropTypes.string,
  playStoreButtonImageUrl: PropTypes.string,
  onPlayStoreButtonClick: PropTypes.func,
  'android-alt': PropTypes.string,
  'ios-alt': PropTypes.string
} : {};
function MoocFooter(props) {
  const {
    headSection = {},
    socialLinks = [],
    'logo-aria-label': logoAriaLabel,
    'social-links-aria-label': socialLinksAriaLabel,
    siteMapSections = []
  } = props;

  // Header section of the footer (the marketing banner)

  const headSectionView = !_isEmpty(headSection) ? /*#__PURE__*/React.createElement("div", {
    "data-name": "headSpacingContainer",
    className: style.headSpacingContainer
  }, /*#__PURE__*/React.createElement("div", {
    "data-name": "headSection",
    className: style.headSectionWrapper
  }, /*#__PURE__*/React.createElement("div", {
    className: style.logoAndLabelWrapper
  }, /*#__PURE__*/React.createElement("div", {
    className: style.logoWrapper
  }, /*#__PURE__*/React.createElement(CoorpAppLogo, {
    className: style.coorpAppLogo,
    "aria-label": headSection['logo-aria-label']
  })), /*#__PURE__*/React.createElement("div", {
    "data-name": "mobile-marketing-text",
    className: style.marketingLabel
  }, headSection.title)), /*#__PURE__*/React.createElement("div", {
    "data-name": "mobile-apps-buttons-wrapper",
    className: style.mobileAppLinks
  }, /*#__PURE__*/React.createElement(StoresLinks
  // ignored due to naming conventions in JSX rather than a linting error
  // eslint-disable-next-line react/jsx-handler-names
  , {
    onAppStoreButtonClick: headSection.onAppStoreButtonClick,
    appStoreButtonImageUrl: headSection.appStoreButtonImageUrl,
    playStoreButtonImageUrl: headSection.playStoreButtonImageUrl
    // eslint-disable-next-line react/jsx-handler-names
    ,
    onPlayStoreButtonClick: headSection.onPlayStoreButtonClick,
    "android-alt": headSection['android-alt'],
    "ios-alt": headSection['ios-alt']
  })))) : null;

  // Sitemap section of the footer (contains HELP, TOOLBOX... and other pages, as well as social links)

  const renderPagesFromSection = pages => {
    return /*#__PURE__*/React.createElement("ul", {
      className: style.pagesList,
      "data-name": "pages-list"
    }, pages.map((page, pindex) => {
      const handleClick = page.onClick;
      return /*#__PURE__*/React.createElement("li", {
        key: pindex
      }, /*#__PURE__*/React.createElement(Link, {
        href: page.link,
        onClick: handleClick,
        title: page.title,
        "data-text": page.title,
        className: style.pageLink,
        target: page.target,
        "aria-label": page.ariaLabel ? page.ariaLabel : page.title,
        "data-name": page.title
      }, page.title));
    }));
  };
  const sections = !_isEmpty(siteMapSections) ? siteMapSections.map((section, index) => {
    return /*#__PURE__*/React.createElement("nav", {
      key: index,
      className: style.sectionWrapper
    }, /*#__PURE__*/React.createElement("p", {
      className: style.sectionTitle
    }, section.title), renderPagesFromSection(section.pages));
  }) : null;
  const socialLinksView = socialLinks.map((socialLink, index) => {
    return /*#__PURE__*/React.createElement("li", {
      className: style.socialLink,
      key: index
    }, /*#__PURE__*/React.createElement(SocialLink, {
      type: socialLink.type,
      link: socialLink.link,
      mode: "footer",
      "aria-label": socialLink['aria-label']
    }));
  });
  const socialNetworks = /*#__PURE__*/React.createElement("div", {
    "data-name": "logo-social-networks-container",
    className: style.logoSocialNetworksContainer
  }, /*#__PURE__*/React.createElement(CoorpLogo, {
    className: style.coorpLogo,
    "data-name": "coorp-social-networks-logo",
    "aria-label": logoAriaLabel
  }), /*#__PURE__*/React.createElement("ul", {
    "data-name": "social-networks-wrapper",
    className: style.socialNetworksWrapper,
    "aria-label": socialLinksAriaLabel
  }, socialLinksView));
  const siteMap = /*#__PURE__*/React.createElement("div", {
    "data-name": "site-map-spacing-container",
    className: style.siteMapSpacingContainer
  }, /*#__PURE__*/React.createElement("div", {
    "data-name": "site-map",
    className: style.siteMapContainer
  }, /*#__PURE__*/React.createElement("div", {
    "data-name": "sections",
    className: style.sectionsContainer
  }, sections), socialNetworks));
  return /*#__PURE__*/React.createElement("footer", {
    "data-name": "mooc-footer"
  }, headSectionView, siteMap);
}
MoocFooter.propTypes = process.env.NODE_ENV !== "production" ? {
  headSection: PropTypes.shape({
    title: PropTypes.string,
    onAppStoreButtonClick: PropTypes.func,
    appStoreButtonImageUrl: PropTypes.string,
    playStoreButtonImageUrl: PropTypes.string,
    onPlayStoreButtonClick: PropTypes.func,
    'logo-aria-label': PropTypes.string,
    'android-alt': PropTypes.string,
    'ios-alt': PropTypes.string
  }),
  siteMapSections: PropTypes.arrayOf(PropTypes.shape({
    title: PropTypes.string,
    pages: PropTypes.arrayOf(PropTypes.shape({
      title: PropTypes.string,
      link: PropTypes.string,
      target: PropTypes.string,
      ariaLabel: PropTypes.string
    }))
  })),
  socialLinks: PropTypes.arrayOf(PropTypes.shape({
    type: PropTypes.oneOf(socialLinksTypes),
    link: PropTypes.string,
    onClick: PropTypes.func,
    'aria-label': PropTypes.string
  })),
  'logo-aria-label': PropTypes.string,
  'social-links-aria-label': PropTypes.string
} : {};
export default MoocFooter;
//# sourceMappingURL=index.js.map