import React from "react";
import {
  Title,
  Subtitle,
  Description,
  Primary,
} from "@storybook/addon-docs/blocks";
import { Wrap } from "../../../../src/atoms/wrap";
import { Container } from "../../../../src/atoms/container";
import { H3 } from "../../../../src/atoms/base";
import { Row, Column } from "../../../../src/atoms/grid";
import { NavLink } from "../../../../src/atoms/nav";

export default {
  title: "Components/Wrap",
  component: Wrap,
  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>
            `Wrap` are useful when you want to change the background or
            highlight some block or even whole pag. To apply it at your product
            you may use next `props`:
          </Description>
          <Description>
            1. `border` in case need to highlight some block of information.
          </Description>
          <Description>
            2. `light` to change the color of the `border` on the lighter preset
            one.
          </Description>
          <Description>
            3. `background` in case you need to apply some color or gradient.
          </Description>
          <Description>
            4. `image` in case you need to apply some image on background, you
            may use it together with `background`.
          </Description>
          <Description>
            5. `fluidHeight` by using this `props` you make the `Wrap` full
            screen on height, it will follow the `body`.
          </Description>
          <br />
          <Subtitle>
            To integrate Wrap for using at your product, please read the
            information below, or check the example code in stories.
          </Subtitle>
          <Description>
            1. `import &#123; Wrap &#125; from 'seturon';`
          </Description>
          <Description>2. Set the component on the needed page.</Description>
          <Description>3. Set needed `props` at the component.</Description>
          <br />
          <Subtitle>
            To have more idea about the code and usage of the Wrap components,
            check it out:
          </Subtitle>
          <NavLink href="http://design.seturon.io/?path=/docs/components-wrap--example">
            Example
          </NavLink>
        </>
      ),
    },
  },
  args: {
    fluidHeight: false,
    border: false,
    light: false,
  },
  argTypes: {
    props: {
      description: null,
      table: {
        type: {
          summary: null,
          detail: null,
        },
      },
      control: {
        type: null,
      },
    },
  },
};

export const Simple = (args) => (
  <Container bgWhite fluidHeight>
    <Wrap
      p5
      {...args}
      background="#F2F6FF"
      image="https://storage.googleapis.com/seturon-prod/images/d828527a-64eb-41ff-8949-4864937b3697.svg"
    >
      <Row>
        <Column textCenter>
          <H3>Wrap</H3>
        </Column>
      </Row>
    </Wrap>
  </Container>
);

export const Example = () => (
  <Wrap
    p5
    fluidHeight
    background="linear-gradient(180deg, #F2F6FF 0%, rgba(242, 246, 255, 0) 100%);"
  >
    <Wrap
      m5
      p5
      border
      light
      background="#FFF"
      image="https://storage.googleapis.com/seturon-prod/images/d828527a-64eb-41ff-8949-4864937b3697.svg"
    >
      <Row>
        <Column textCenter>
          <H3>Wrap with image</H3>
        </Column>
      </Row>
    </Wrap>
    <Wrap m5 p5 border light background="#165EFE">
      <Row>
        <Column textCenter>
          <H3>Wrap with color</H3>
        </Column>
      </Row>
    </Wrap>
    <Wrap m5 p5 border>
      <Row>
        <Column textCenter>
          <H3>Simple Bordered Wrap</H3>
        </Column>
      </Row>
    </Wrap>
  </Wrap>
);

Example.storyName = "Example";

Example.parameters = {
  component: Wrap,
  docs: {
    page: () => (
      <>
        <Title>Example</Title>
        <Subtitle>Props</Subtitle>
        <Description>
          `Wrap` are useful when you want to change the background or highlight
          some block or even whole pag. To apply it at your product you may use
          next `props`:
        </Description>
        <Description>
          1. `border` in case need to highlight some block of information.
        </Description>
        <Description>
          2. `light` to change the color of the `border` on the lighter preset
          one.
        </Description>
        <Description>
          3. `background` in case you need to apply some color or gradient.
        </Description>
        <Description>
          4. `image` in case you need to apply some image on background, you may
          use it together with `background`.
        </Description>
        <Description>
          5. `fluidHeight` by using this `props` you make the `Wrap` full screen
          on height, it will follow the `body`.
        </Description>
        <br />
        <Subtitle>
          Check the code below to get an idea of how to use it at your product👇
        </Subtitle>
        <Primary name="Example" />
      </>
    ),
  },
};
