import * as React from "react";
import { GRP } from "storybook/GRP";
import { withKnobs, text, boolean, number } from "@storybook/addon-knobs";

import Layout from "../Layout";
import { UrgencyLayouts } from "./types";
import theme from "../theme";

import {
  EditorWithCustomData,
  buildContentData,
  mobileStateData,
} from "@sc/modules/page/Builder/Builder.stories";

import {
  settings01,
  settings02,
  settings03,
  settings04,
  settings05,
  settings06,
} from "./";

export default {
  title: "Plugins|Web Layouts/Urgency",
  decorators: [withKnobs],
};

export const Urgency01: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={UrgencyLayouts.ONE}>
          <Layout type={UrgencyLayouts.ONE} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="http://ambid-backups.s3.amazonaws.com/screenshots/sandcastle/placeholders/Urgency/01.png"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings01.default])}
        />
      )}
    </>
  );
};

export const Urgency02: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={UrgencyLayouts.TWO}>
          <Layout type={UrgencyLayouts.TWO} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="http://ambid-backups.s3.amazonaws.com/screenshots/sandcastle/placeholders/Urgency/02.png"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings02.default])}
        />
      )}
    </>
  );
};

export const Urgency03: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={UrgencyLayouts.THREE}>
          <Layout type={UrgencyLayouts.THREE} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="http://ambid-backups.s3.amazonaws.com/screenshots/sandcastle/placeholders/Urgency/03.png"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings03.default])}
        />
      )}
    </>
  );
};

export const Urgency04: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={UrgencyLayouts.FOUR}>
          <Layout type={UrgencyLayouts.FOUR} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="http://ambid-backups.s3.amazonaws.com/screenshots/sandcastle/placeholders/Urgency/04.png"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings04.default])}
        />
      )}
    </>
  );
};

export const Urgency05: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={UrgencyLayouts.FIVE}>
          <Layout type={UrgencyLayouts.FIVE} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="http://ambid-backups.s3.amazonaws.com/screenshots/sandcastle/placeholders/Urgency/05.png"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings05.default])}
        />
      )}
    </>
  );
};

export const Urgency06: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={UrgencyLayouts.SIX}>
          <Layout type={UrgencyLayouts.SIX} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="http://ambid-backups.s3.amazonaws.com/screenshots/sandcastle/placeholders/Urgency/06.png"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings06.default])}
        />
      )}
    </>
  );
};

export const InTheEditor: React.FC = () => {
  return (
    <EditorWithCustomData
      defaultMobileState={mobileStateData.desktop}
      content={buildContentData([
        settings01.default,
        settings02.default,
        settings03.default,
        settings04.default,
        settings05.default,
        settings06.default,
      ])}
    />
  );
};

export const All: React.FC = () => {
  const data = {
    section: {
      pageMargin: number("Page Margin", 980, {
        range: true,
        min: 500,
        max: 2000,
      }),
    },
    main_headline: {
      html: text("Main Headline Text", "I have overrided the text"),
      render: boolean("Show Main Headline", true),
    },
    sub_headline: {
      render: boolean("Show Sub Headline", true),
    },
    hero_video: {
      render: boolean("Show Hero Video", true),
    },
    cta_button: {
      render: boolean("Show Button (If Present)", true),
    },
  };

  return (
    <>
      <GRP title={UrgencyLayouts.ONE}>
        <Layout type={UrgencyLayouts.ONE} data={data} />
      </GRP>

      <GRP title={UrgencyLayouts.TWO}>
        <Layout type={UrgencyLayouts.TWO} data={data} />
      </GRP>

      <GRP title={UrgencyLayouts.THREE}>
        <Layout type={UrgencyLayouts.THREE} data={data} />
      </GRP>

      <GRP title={UrgencyLayouts.FOUR}>
        <Layout type={UrgencyLayouts.FOUR} data={data} />
      </GRP>

      <GRP title={UrgencyLayouts.FIVE}>
        <Layout type={UrgencyLayouts.FIVE} data={data} />
      </GRP>

      <GRP title={UrgencyLayouts.SIX}>
        <Layout type={UrgencyLayouts.SIX} data={data} />
      </GRP>
    </>
  );
};
