import React from "react";
import {
  Title,
  Subtitle,
  Description,
  Primary,
} from "@storybook/addon-docs/blocks";
import { Container } from "../../../../src/atoms/container";
import { Divider, DividerStart } from "../../../../src/atoms/divider";
import { TextWithIcon } from "../../../../src/molecules/textWithIcon";
import { InfoIcon } from "../../../../src/atoms/icon";
import { NavLink } from "../../../../src/atoms/nav";

export default {
  title: "Components/Divider",
  component: Divider,
  parameters: {
    docs: {
      page: () => (
        <>
          <Title>Readme</Title>
          <br />
          <Subtitle>
            Note, thise story is explains more about the basic usage of the
            component in your project, how to import and render it. You may find
            examples of code at the story Example.
          </Subtitle>
          <Description>
            A `Divider` line separates different content. There are 2 types of `Divider`:
          </Description>
          <Description>
            1. `Divider` with the text in between.
          </Description>
          <Description>
            2. `DividerStart` with the text at the start.
            completed task.
          </Description>
          <br />
          <Subtitle>
            To integrate Divider for using at your product, please read the
            information below, or check the example code in stories.
          </Subtitle>
          <Description>
            1. `import &#123; Divider &#125; from 'seturon';` or `import &#123;
            DividerStart &#125; from 'seturon';`
          </Description>
          <Description>2. Set the component on the needed page.</Description>
          <br />
          <Subtitle>
            To have more idea about the code and usage of the Divider components,
            check it out:
          </Subtitle>
          <NavLink href="http://design.seturon.io/?path=/docs/components-divider--example">
            Example
          </NavLink>
        </>
      ),
    },
  },
  args: {
    theme: null,
  },
  argTypes: {
    props: {
      description: null,
      table: {
        type: {
          summary: null,
          detail: null,
        },
      },
      control: {
        type: null,
      },
    },
  },
};

export const Readme = () => (
  <Container>
    <Divider>Dividers</Divider>
  </Container>
);

export const Example = () => (
  <Container bgWhite>
    <Divider>Divider with text in between</Divider>
    <br/>
    <DividerStart>
      <TextWithIcon textSecondary text="Divider with text at start" iconL={<InfoIcon width={18} height={18} fill={"#939EAB"} />}/>
    </DividerStart>
  </Container>
);

Example.storyName = "Example";

Example.parameters = {
  component: Divider,
  docs: {
    page: () => (
      <>
        <Title>Example</Title>
        <Subtitle>Props</Subtitle>
        <Description>
            A `Divider` line separates different content. There are 2 types of `Divider`:
          </Description>
          <Description>
            1. `Divider` with the text in between.
          </Description>
          <Description>
            2. `DividerStart` with the text at the start.
            completed task.
          </Description>
        <br />
        <Subtitle>
          Check the code below to get an idea of how to use it at your product👇
        </Subtitle>
        <Primary name="Example" />
      </>
    ),
  },
};
