import React from 'react';
import {
  Title,
  Subtitle,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';

import Image from '.';

export default {
  title: 'Theme/Atoms/Image',
  component: Image,
  argTypes: {
    module: {
      name: 'module',
      type: { name: 'object', required: false },
      defaultValue: '',
      description: 'The module data object',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: '' },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'A component that displays a lazy-loaded image with alignment options coming from Hercules. Works with the Hercules image module.',
      },
      page: () => (
        <>
          <Title />
          <Subtitle />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

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

export const Default = Template.bind({});
Default.args = {
  module: {
    alignment: 'align_center',
    title: 'Image Title',
    value: 'fit-in/960x250/313df295c19d7c5f137ceda9d0cc5df7.jpeg',
    alt: 'Image Alt',
  },
};
