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

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/Navigation",
  decorators: [withKnobs],
};

export const Navigation01: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={NavigationLayouts.ONE}>
          <Layout type={NavigationLayouts.ONE} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="https://assets.website-files.com/5d4fd160326ec183bf464939/5d4fd160326ec1f0a6464a13_Menu%2012.jpg"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings01.default])}
        />
      )}
    </>
  );
};

export const Navigation02: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={NavigationLayouts.TWO}>
          <Layout type={NavigationLayouts.TWO} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="https://assets.website-files.com/5d4fd160326ec183bf464939/5d4fd160326ec1e2b7464a1a_Menu%206.jpg"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings02.default])}
        />
      )}
    </>
  );
};

export const Navigation03: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={NavigationLayouts.THREE}>
          <Layout type={NavigationLayouts.THREE} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="https://assets.website-files.com/5d4fd160326ec183bf464939/5d4fd160326ec1620a464a17_Menu%207.jpg"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings03.default])}
        />
      )}
    </>
  );
};

export const Navigation04: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={NavigationLayouts.FOUR}>
          <Layout type={NavigationLayouts.FOUR} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="https://assets.website-files.com/5d4fd160326ec183bf464939/5d4fd160326ec1e91b464a3d_Menu%2010.jpg"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings04.default])}
        />
      )}
    </>
  );
};

export const Navigation05: React.FC = () => {
  return (
    <>
      {boolean("Show Section", false) && (
        <GRP title={NavigationLayouts.FIVE}>
          <Layout type={NavigationLayouts.FIVE} />
        </GRP>
      )}
      {boolean("Show inspiration", false) && (
        <GRP
          title="Inspiration"
          src="https://assets.website-files.com/5d4fd160326ec183bf464939/5d4fd160326ec14851464a1d_Menu%205.jpg"
        />
      )}
      {boolean("In the Editor", true) && (
        <EditorWithCustomData
          defaultMobileState={mobileStateData.desktop}
          content={buildContentData([settings05.default])}
        />
      )}
    </>
  );
};

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

export const AllLayouts: 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 (
    <div>
      <GRP title={NavigationLayouts.ONE}>
        <Layout type={NavigationLayouts.ONE} data={data} />
      </GRP>

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

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

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

      <GRP title={NavigationLayouts.FIVE}>
        <Layout type={NavigationLayouts.FIVE} data={data} />
      </GRP>
    </div>
  );
};
