import * as React from "react";
import { get } from "lodash";

import { style } from "./style";
import { default as defaultData } from "./data.json";

import { doIShow, combineData, lorem } from "../../utils";

import theme from "../../theme";

import {
  Block,
  Section,
  Headline,
  Text,
  Container,
  Button,
  Grid,
  GridItem,
  List,
} from "@sc/plugins/webcomponents/v2";
import { ImagePlaceholder, ImagePlaceholderTypes } from "../../Placeholders";
import { IconTypes } from "@sc/plugins/webcomponents/v2/Icon";

type LayoutProps = {
  data: any;
};

const Layout: React.FC<LayoutProps> = ({ data }) => {
  const initialContent = {
    main_headline: {
      html: "Headline Goes Here",
    },
    sub_headline: {
      html: "Sub Headline Text Content Goes Here",
    },
  };

  const content = combineData(initialContent, defaultData, data);

  return (
    <Block>
      <Section style={style.SECTION}>
        <Container
          style={{
            ...style.SECTION_INNER,
            maxWidth: get(data, "section.pageMargin"),
          }}
        >
          <Headline style={style.HEADLINE}>
            Get Your 10 Minute Funnels Account Now!
          </Headline>

          <Headline style={style.SUBHEADLINE}>
            50%-OFF DISCOUNT (A SAVINGS of $400.00)
          </Headline>

          <Grid spacing={2} style={{ marginTop: 40 }}>
            <GridItem xs={6}>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{ backgroundColor: theme.backgroundColor }}
              />
            </GridItem>
            <GridItem xs={6}>
              <List
                data={[
                  {
                    caption:
                      "<strong>Free Bonus #1:</strong> " +
                      lorem.generateSentences(1),
                    style: style.LISTITEM.style,
                    iconStyle: style.LISTITEM.iconStyle,
                    contentStyle: style.LISTITEM.contentStyle,
                    icon: IconTypes.CheckCircleOutline,
                  },
                  {
                    caption:
                      "<strong>Free Bonus #2:</strong> " +
                      lorem.generateSentences(1),
                    style: style.LISTITEM.style,
                    iconStyle: style.LISTITEM.iconStyle,
                    contentStyle: style.LISTITEM.contentStyle,
                    icon: IconTypes.CheckCircleOutline,
                  },
                  {
                    caption:
                      "<strong>Free Bonus #3:</strong> " +
                      lorem.generateSentences(1),
                    style: style.LISTITEM.style,
                    iconStyle: style.LISTITEM.iconStyle,
                    contentStyle: style.LISTITEM.contentStyle,
                    icon: IconTypes.CheckCircleOutline,
                  },
                  {
                    caption:
                      "<strong>Free Bonus #4:</strong> " +
                      lorem.generateSentences(1),
                    style: style.LISTITEM.style,
                    iconStyle: style.LISTITEM.iconStyle,
                    contentStyle: style.LISTITEM.contentStyle,
                    icon: IconTypes.CheckCircleOutline,
                  },
                ]}
              />
            </GridItem>
          </Grid>

          <Container
            style={{
              padding: 40,
              backgroundColor: "#EEE",
              marginTop: 40,
              borderRadius: 5,
              border: "1px solid #DDD",
            }}
          >
            <Headline style={{ ...style.HEADLINE, fontSize: "22pt" }}>
              Your Full 30-Day 100% Money-Back Guarantee
            </Headline>

            <Headline style={{ ...style.SUBHEADLINE, fontSize: "18pt" }}>
              Just Say "Maybe"...
            </Headline>

            <Headline style={{ ...style.SUBHEADLINE, fontSize: "14pt" }}>
              And Put It To The Test For An Entire Month... Then Decide
            </Headline>

            <Text style={style.TEXT}>{lorem.generateParagraphs(1)}</Text>
            <Text style={style.TEXT}>{lorem.generateParagraphs(1)}</Text>
          </Container>

          <Button
            style={style.BUTTON.style}
            caption1="Get Your Account Now!"
            caption1style={style.BUTTON.caption1}
          />

          <Text
            style={{
              ...style.TEXT,
              fontWeight: "bold" as "bold",
              color: theme.highlightColor,
              textAlign: "center",
            }}
          >
            ** This Discount Offer & All Bonuses <u>EXPIRES TONIGHT</u> At
            Midnight **
          </Text>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
