/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';

import Newsletter from '.';

export default {
  title: 'Theme/Molecules/Newsletter Optin',
  component: Newsletter,
  argTypes: {
    page: {
      name: 'page',
      type: { name: 'object', required: true },
      defaultValue: null,
      description: 'The page object.',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: null },
      },
    },
    title: {
      name: 'title',
      type: { name: 'string', required: false },
      defaultValue: 'Exclusive Casino Offers and Free Spins straight to your Inbox',
      description: `This text message will show on top of Newsletter as a title.`,
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: 'Exclusive Casino Offers and Free Spins straight to your Inbox' },
      },
    },
    description: {
      name: 'description',
      defaultValue:
        'Subscribe below to be the first to get notified of exclusive casino offers, free spins and bonuses - conveniently via email or SMS. We won’t flood your inbox, but just give you the good stuff in the right way!',
      description: `This text message will be shown below the title.`,
      table: {
        type: { summary: 'string' },
        defaultValue: {
          summary:
            'Subscribe below to be the first to get notified of exclusive casino offers, free spins and bonuses - conveniently via email or SMS. We won’t flood your inbox, but just give you the good stuff in the right way!',
        },
      },
    },
    terms: {
      name: 'terms',
      defaultValue: 'I confirm that I am 18+ years old and Irish resident.',
      description: `This text message shows Terms and Conditions.`,
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: 'I confirm that I am 18+ years old and Irish resident.' },
      },
    },
    privacy_text: {
      name: 'privacy_text',
      defaultValue: 'Read our Privacy Policy for more details.',
      description: `This text message shows the URL for Privacy Policy.`,
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: 'Read our Privacy Policy for more details.' },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component: 'Generates Newsletter Optin form on PPC pages.',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

const Template = (args) => <Newsletter {...args} />;

export const Default = Template.bind({});
Default.args = {
  page: {},
  title: 'Exclusive Casino Offers and Free Spins straight to your Inbox',
  description:
    'Subscribe below to be the first to get notified of exclusive casino offers, free spins and bonuses - conveniently via email or SMS. We won’t flood your inbox, but just give you the good stuff in the right way!',
  terms: 'I confirm that I am 18+ years old and Irish resident.',
  privacy_text: 'Read our Privacy Policy for more details.',
};
