import storyTeaserFeaturedTwig from './node.story.teaser-featured.twig';
import storyTeaserFeaturedData from './node.story.teaser-featured.yml';
import './node.story.teaser-featured.js';

import linkTwig from '@ui-base/link/_link.twig';

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

/**
 * Storybook Definition.
 */
export default {
  title: 'Content Types/Story/Teaser Featured',
};

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

  return storyTeaserFeaturedTwig({
    ...data,
    node_teaser_label_as_link: linkTwig({ link_text: data.node_teaser_label_as_link }),
    node_teaser_field_summary: formatParagraphCKEditor(data.node_teaser_field_summary),
  });
}
teaserFeatured.args = storyTeaserFeaturedData;
