import './social-icons.scss';
import {createElement} from "../../_global/scripts/helpers";
import {socialIconsBookmark, socialIconsPlatforms} from "./SocialIconsData";

export const createSocialIcons =
  ({
    items = socialIconsPlatforms,
    title = '',
  }) => {
    const ul = createElement('ul', ['social-icons']);
    items.map((item) => {
      const li = createElement('li', [], null, ul);
      const a = createElement('a', ['social-share', item.name.toLowerCase()], null, li);
      a.href = item.href;
      if (title && title.length > 0) {
        a.title = title + item.name;
      }
      if (item.onClick && item.onClick.length > 0) {
        a.onclick = item.onClick;
      }
    })

    return ul;
  }