/* 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',
  component: Newsletter,
  argTypes: {
    page: {
      name: 'page',
      type: { name: 'object', required: true },
      defaultValue: null,
      description: 'The page object.',
    },
    mainText: {
      name: 'mainText',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Main text',
    },
    subscribeText: {
      name: 'subscribeText',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Subscribe Text',
    },
    placeholderName: {
      name: 'placeholderName',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Placeholder Name',
    },
    placeholderEmail: {
      name: 'placeholderEmail',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Placeholder Email',
    },
    privacyText: {
      name: 'privacyText',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Privacy Text',
    },
    openBtnText: {
      name: 'openBtnText',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Open Button Text',
    },
    buttonText: {
      name: 'buttonText',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Button Text',
    },
    formAction: {
      name: 'formAction',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Form Action',
    },
    newsletterListId: {
      name: 'newsletterListId',
      type: { name: 'String', required: false },
      defaultValue: '',
      description: 'Newsletter List Id',
    },
    footer: {
      name: 'footer',
      type: { name: 'boolean', required: true },
      defaultValue: false,
      description: 'Footer Newsletter',
    },
  },
  parameters: {
    docs: {
      description: {
        component: 'Newsletter component',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

export const Default = Template.bind({});
Default.args = {
  page: {},
  mainText: 'You get more than 405 free spins',
  subscribeText: 'Subscribe to our newsletter and get more than 405 free spins instantly.',
  placeholderName: 'Name',
  placeholderEmail: 'Email',
  privacyText:
    'By subscribing, you confirm that you are over 18 years of age and that you accept our',
  openBtnText: 'FÅ 405 FREE SPINS UMIDDELBART',
  buttonText: 'Hent dine freespins',
  formAction: '',
  newsletterListId: '',
  footer: false,
};
