import inThisSectionTwig from './paragraph.in-this-section.twig';
import inThisSectionData from './paragraph.in-this-section.yml';
import './paragraph.in-this-section.js';

import linkTwig from '@ui-base/link/_link.twig';
import { setPublishedStatus } from '.storybook/utils';

/**
 * Storybook Definition.
 */
export default {
  title: 'Layout Components/In This Section',
};

export const inThisSection = (args) => {
  // Create deep copy of data and merge args.
  let data = JSON.parse(JSON.stringify(inThisSectionData ?? {}));
  data = Object.assign(data, args);

  data.paragraph = setPublishedStatus(data.paragraph_is_published);

  return inThisSectionTwig({
    ...data,
    section_menu_parent_label_as_link: linkTwig({ ...data.section_menu_parent_label_as_link })
  });
}
inThisSection.args = inThisSectionData;
