import menuTwig from '@ui-navigation/menu.html.twig';

import socialData from './menu.social.yml';
import './menu.social.js';

import { icon } from '@ui-component/icon/icon.stories.js';

import { setMenuItemAttribues } from '.storybook/utils';

import drupalAttribute from 'drupal-attribute';

/**
 * Storybook Definition.
 */
export default { title: 'Navigation/Menus/Social' };

export const social = () => {
  let socialDataCopy = JSON.parse(JSON.stringify(socialData));

  socialDataCopy.items.forEach(item => {
    setMenuItemAttribues(item);

    item['title'] = icon({ icon: item.title });
  });

  return menuTwig({
    ...socialDataCopy,
    attributes: new drupalAttribute(),
  });
}
