import './nav.scss';
import $ from 'jquery';
import {createElement} from "../../_global/scripts/helpers";
import IHKNav from "./nav";
import {createSecondaryMenu} from "../../atoms/secondary-menu/SecondaryMenuComponent";

export const createNav = ({
  secondaryLinks = ['Über uns', 'Presse', 'Newsletter'],
  languageLinks = ['CZ', 'EN'],
  iconLinks = [
    {
      iconClass: 'sign-language',
      label: 'Zeichensprache',
    },
    {
      iconClass: 'simple-language',
      label: 'Einfach Sprache',
    },
    {
      iconClass: 'login',
      label: 'Einloggen',
    }
  ]
}) => {
  const nav = createElement('nav', ['variant-base']);
  createElement('div', ['overlay-holder','variant-subtle-primary'], null, nav);

  const primary = createElement('div', ['primary'], 'Nav', nav);
  primary.dataset.rootUrl = '12191410.json';
  primary.dataset.baseUrl = 'services/nav/';
  primary.dataset.pageContentId = '12191410';

  nav.appendChild(createSecondaryMenu({}));

  $(document).ready(() => {
    const n = new IHKNav($(nav));
    if (!n.nav.closest('.page-header').length) {
      n.nav.wrap($('<header class="page-header dummy" />'));
    }
  })

  return nav;
}