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

export default {
  title: "Components/Grid",
  component: Row,
  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>
            Use `Row` and `Column` components to organize other components at
            the screen or at some block. To setup it use next `props`:
          </Description>
          <Description>
            1. `xs` setup `Column` size for very small size of the screen
          </Description>
          <Description>
            2. `sm` setup `Column` size for small size of the screen
          </Description>
          <Description>
            3. `md` setup `Column` size for medium size of the screen, for this
            `props` you may also use `mdOffset`
          </Description>
          <Description>
            4. `lg` setup `Column` size for large size of the screen
          </Description>
          <Description>
            5. `xl` setup `Column` size for the largest size of the screen
          </Description>
          <br />
          <Subtitle>
            To integrate Grid for using at your product, please read the
            information below, or check the example code in stories.
          </Subtitle>
          <Description>
            1. `import &#123; Row, Column &#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 Grid components,
            check it out:
          </Subtitle>
          <NavLink href="http://design.seturon.io/?path=/docs/components-grid--example">
            Example
          </NavLink>
        </>
      ),
    },
  },
  args: {
    props: null,
  },
  argTypes: {
    props: {
      description: null,
      table: {
        type: {
          summary: null,
          detail: null,
        },
      },
      control: {
        type: null,
      },
    },
  },
};

export const Readme = () => (
  <Row bgDarker p2>
    <Column md={2} bgLight p2>
      {"md={2}"}
    </Column>
    <Column md={2} bgPrimary p2>
      {"md={2}"}
    </Column>
    <Column md={8} bgLight p2>
      {"md={8}"}
    </Column>
  </Row>
);

export const Example = () => (
  <>
    <Row bgDarker p2>
      <Column bgLight p2>
        {"no props"}
      </Column>
      <Column bgPrimary p2>
        {"no props"}
      </Column>
      <Column bgLight p2>
        {"no props"}
      </Column>
    </Row>
    <Row bgDarker p2>
      <Column xs={4} bgLight p2>
        {"very small size"}
      </Column>
      <Column xs={4} bgPrimary p2>
        {"very small size"}
      </Column>
      <Column xs={4} bgLight p2>
        {"very small size"}
      </Column>
    </Row>
    <Row bgDarker p2>
      <Column sm={4} bgLight p2>
        {"small size"}
      </Column>
      <Column sm={4} bgPrimary p2>
        {"small size"}
      </Column>
      <Column sm={4} bgLight p2>
        {"small size"}
      </Column>
    </Row>
    <Row bgDarker p2>
      <Column md={4} bgLight p2>
        {"medium size"}
      </Column>
      <Column md={4} bgPrimary p2>
        {"medium size"}
      </Column>
      <Column md={4} bgLight p2>
        {"medium size"}
      </Column>
    </Row>
    <Row bgDarker p2>
      <Column mdOffset={4} bgLight p2>
        {"medium size with offset"}
      </Column>
      <Column mdOffset={4} bgPrimary p2>
        {"medium size with offset"}
      </Column>
    </Row>
    <Row bgDarker p2>
      <Column lg={4} bgLight p2>
        {"large size"}
      </Column>
      <Column lg={4} bgPrimary p2>
        {"large size"}
      </Column>
      <Column lg={4} bgLight p2>
        {"large size"}
      </Column>
    </Row>
    <Row bgDarker p2>
      <Column xl={4} bgLight p2>
        {"the largest size"}
      </Column>
      <Column xl={4} bgPrimary p2>
        {"the largest size"}
      </Column>
      <Column xl={4} bgLight p2>
        {"the largest size"}
      </Column>
    </Row>
  </>
);

Example.storyName = "Example";

Example.parameters = {
  component: Row,
  docs: {
    page: () => (
      <>
        <Title>Example</Title>
        <Subtitle>Props</Subtitle>
        <Description>
          Use `Row` and `Column` components to organize other components at the
          screen or at some block. To setup it use next `props`:
        </Description>
        <Description>
          1. `xs` setup `Column` size for very small size of the screen
        </Description>
        <Description>
          2. `sm` setup `Column` size for small size of the screen
        </Description>
        <Description>
          3. `md` setup `Column` size for medium size of the screen, for this
          `props` you may also use `mdOffset`
        </Description>
        <Description>
          4. `lg` setup `Column` size for large size of the screen
        </Description>
        <Description>
          5. `xl` setup `Column` size for the largest size of the screen
        </Description>
        <br />
        <Subtitle>
          Check the code below to get an idea of how to use it at your product👇
        </Subtitle>
        <Primary name="Example" />
      </>
    ),
  },
};
