import React from "react";
import {
  Title,
  Subtitle,
  Description,
  Primary,
} from "@storybook/addon-docs/blocks";
import {
  Card,
  CardBody,
  CardHeader,
  CardImageHeader,
  CardText,
  CardTitle,
} from "../../../../src/atoms/card";
import { Badge } from "../../../../src/atoms/badge";
import {
  CloseIcon,
  RentangleIcon,
  StarSmallIcon,
  SubscriptionYearIcon,
} from "../../../../src/atoms/icon";
import { Div, Small } from "../../../../src/atoms/base";
import { CardTarif } from "../../../../src/molecules/cardTarif";
import { NavLink } from "../../../../src/atoms/nav";

export default {
  title: "Components/Card",
  component: Card,
  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>
            `Card` are useful for distinguishing and highlighting of the
            specific blocks and information. It consist of:
          </Description>
          <Description>1. `Card` the card appearance itself.</Description>
          <Description>2. `CardBody` the card content base.</Description>
          <Description>
            3. `CardImageHeader` you may upload any of the picture using this
            component.
          </Description>
          <Description>
            4. `CardTitle` you may highlight the main point information.
          </Description>
          <Description>
            5. `CardText` you may just set some additional information.
          </Description>
          <Description>
            6. `CardHeader` you may set eather text or image.
          </Description>
          <br />
          <Subtitle>
            To integrate Card for your using at your product, please read the
            information below, or check the example code in stories.
          </Subtitle>
          <Description>
            1. `import &#123; CardBody, CardHeader, CardImageHeader, CardText,
            CardTitle, &#125; from 'seturon';` or `import &#123; CardTarif
            &#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 Card components,
            check it out:
          </Subtitle>
          <NavLink href="http://design.seturon.io/?path=/docs/components-card--example">
            Example
          </NavLink>
        </>
      ),
    },
  },
  args: {
    loading: false,
    disabled: false,
    button: false,
    h1: false,
    h2: false,
    h3: false,
    h4: true,
  },
  argTypes: {
    props: {
      description: null,
      table: {
        type: {
          summary: null,
          detail: null,
        },
      },
      control: {
        type: null,
      },
    },
  },
};

export const Readme = (args) => (
  <>
    <Card style={{ width: "18rem" }} {...args}>
      <CardImageHeader
        {...args}
        src="https://storage.googleapis.com/seturon-prod/images/8268fb25-37a1-4b1a-aa9f-eea3e2135272.svg"
      />
      <CardBody {...args}>
        <CardTitle h4 {...args}>
          About this Course
        </CardTitle>
        <CardText {...args}>
          Do you realize that the only functionality of a web application that
          the user directly interacts with is through the web page? Implement it
          poorly and, to the user, the server-side becomes irrelevant!...
        </CardText>
        <Badge pill m1 {...args}>
          Not started
        </Badge>
        <Badge pill m1 primary {...args}>
          Comming soon
        </Badge>
      </CardBody>
    </Card>
  </>
);

export const Example = () => (
  <>
    <Card mb5>
      <CardBody sm button>
        <Div floatLeft>
          <RentangleIcon mt9 width={24} height={24} fill={"#9874FF"} />
        </Div>
        <Div floatLeft pl5>
          <Small textLeft textBottom>
            Maria Korshunova
          </Small>
        </Div>
        <Div floatRight pl5>
          <StarSmallIcon width={24} height={24} fill={"#FFA512"} />
        </Div>
        <Div floatRight pr5>
          <CloseIcon width={24} height={24} fill={"#6E7191"} />
        </Div>
      </CardBody>
    </Card>
    <br />
    <CardTarif
      style={{ width: "18rem" }}
      title="One mounth no limits"
      text="Unlimited access to all courses for one month"
      coast="1000 ₽"
      icon={<SubscriptionYearIcon width={24} height={24} fill={"#165EFE"} />}
    />
    <br />
    <Card style={{ width: "18rem" }} background="#E4FFF0">
      <CardImageHeader src="https://storage.googleapis.com/seturon-prod/images/8268fb25-37a1-4b1a-aa9f-eea3e2135272.svg" />
      <CardBody>
        <CardTitle h4>About this Course</CardTitle>
        <CardText>
          Do you realize that the only functionality of a web application that
          the user directly interacts with is through the web page? Implement it
          poorly and, to the user, the server-side becomes irrelevant!...
        </CardText>
        <Badge pill m1>
          Not started
        </Badge>
        <Badge pill m1 primary>
          Comming soon
        </Badge>
      </CardBody>
    </Card>
    <br />
    <Card style={{ width: "18rem" }}>
      <CardHeader
        disabled
        dark
        src="https://storage.googleapis.com/seturon-prod/images/254ab6df-1c4e-4781-b4b7-7197722afff2.png"
      >
        <Badge pill dark>
          Only for subscriber
        </Badge>
      </CardHeader>
      <CardBody>
        <CardTitle h4>About this Course</CardTitle>
        <CardText>
          Do you realize that the only functionality of a web application that
          the user directly interacts with is through the web page? Implement it
          poorly and, to the user, the server-side becomes irrelevant!...
        </CardText>
        <Badge pill m1>
          Not started
        </Badge>
        <Badge pill m1 primary>
          Comming soon
        </Badge>
      </CardBody>
    </Card>
    <br />
    <Card style={{ width: "18rem" }} loading>
      <CardImageHeader
        loading
        src="https://storage.googleapis.com/seturon-prod/images/8268fb25-37a1-4b1a-aa9f-eea3e2135272.svg"
      />
      <CardBody loading>
        <CardTitle h4 loading>
          About this Course
        </CardTitle>
        <CardText loading>
          Do you realize that the only functionality of a web application that
          the user directly interacts with is through the web page? Implement it
          poorly and, to the user, the server-side becomes irrelevant!...
        </CardText>
        <Badge pill m1 loading>
          Not started
        </Badge>
        <Badge pill m1 primary loading>
          Comming soon
        </Badge>
      </CardBody>
    </Card>
  </>
);

Example.storyName = "Example";

Example.parameters = {
  component: Card,
  docs: {
    page: () => (
      <>
        <Title>Example</Title>
        <Subtitle>Props</Subtitle>
        <Description>
          `Card` are useful for distinguishing and highlighting of the specific
          blocks and information. Here is a `props` you may use:
        </Description>
        <Description>
          1. `button` to show that the `Card` is clickable, and `sm` for the
          smaller size of the `Card`. You may use this `props` with `CardBody`.
        </Description>
        <Description>
          2. `disabled` to show that the information inside is locked. You may
          use this `props` with `CardImageHeader` and `CardHeader`.
        </Description>
        <Description>
          3. `loading` at all parts of the `Card` component, to show that it's
          loading.
        </Description>
        <Description>
          4. `h1`, `h2`, `h3`, and `h4` for the size of `CardTitle` text.
        </Description>
        <Description>
          5. `title`, `text`, `coast`, and `icon` to setup the `CardTarif`
          component.
        </Description>
        <br />
        <Subtitle>
          Check the code below to get an idea of how to use it at your product👇
        </Subtitle>
        <Primary name="Example" />
      </>
    ),
  },
};
