import spotifyPlaylistTwig from './paragraph.spotify-playlist.twig';
import spotifyPlaylistData from './paragraph.spotify-playlist.yml';
import './paragraph.spotify-playlist.js';

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

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

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

  data.paragraph = setPublishedStatus(data.paragraph_is_published);

  return spotifyPlaylistTwig({
    ...data,
  });
}
spotifyPlaylist.args = spotifyPlaylistData;
