import codeBlockTwig from './paragraph.code-block.twig';
import codeBlockData from './paragraph.code-block.yml';
import './paragraph.code-block.js';

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

/**
 * Storybook Definition.
 */
export default {
  title: 'Layout Components/Code Block',
};

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

  data.paragraph = setPublishedStatus(data.paragraph_is_published);

  return codeBlockTwig({
    ...data,
  });
}
codeBlock.args = codeBlockData;
