import React from 'react';
import { Meta, Story } from '@storybook/react';
import { AtomTooltip, ITooltipProps } from 'react/atoms/Tooltip';
import { AtomCaption } from 'react/atoms/Typography/Caption';
import { AtomIcon } from 'react/atoms/Icon/index';

const meta: Meta = {
  title: 'React/atoms/Tooltip/CustomIconText',
  component: AtomTooltip,
  argTypes: {
    text: {
      control: false,
      table: {
        disabled: true
      }
    },
    content: {
      control: false,
      table: {
        disabled: true
      }
    },
    customTextStyle: {
      control: false,
      table: {
        disabled: true
      }
    },
  },
  parameters: {
    controls: { expanded: true },
  },
};

export default meta;

const TemplateTooltipCustomIconText: Story<ITooltipProps> = (props) => {
  return (
    //Custom Container to prevent Storybook to crop tooltip
    <div style={{ height: '120px', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
      <AtomTooltip {...props}>
        <AtomCaption
          align='center'
          size={'xlarge'}
          text={'Hover here for tooltip'}
        />
      </AtomTooltip>
    </div>
  )
}


const IconText = () => {
  return (
    <div
      style={{
        display: 'flex',
        justifyContent: 'space-evenly',
        alignItems: 'center'
      }}>
      <div
        style={{
          width: '50px'
        }}>
        <AtomIcon icon='earn_badges' size={30} />
      </div>
      <div
        style={{
          width: '500px'
        }}>
        <AtomCaption
          color={'neutral100'}
          size={'small'}
          text={"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum"}
        />
      </div>
    </div>
  )
}

export const TooltipWithIconAndText = TemplateTooltipCustomIconText.bind({});
TooltipWithIconAndText.args = {
  content: (<IconText />),
  placement: 'bottom',
  tooltipWidth: '600px'
};
