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,
  FormField,
} from "@sc/plugins/webcomponents/v2";
import { FormFieldTypes } from "@sc/modules/v2/CRUD/FormBuilder/types";

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}>
            Learn the simple tactic I used to rank #1 for "Online Marketing"
          </Headline>

          <Text style={style.TEXT}>{lorem.generateSentences(3)}</Text>

          <FormField
            type={FormFieldTypes.TEXT}
            placeholder="Enter Your Primary Email Here..."
            name="email"
            style={style.FORM_FIELD.style}
            inputStyle={style.FORM_FIELD.inputStyle}
          />
          <Button
            style={style.BUTTON.style}
            caption1="Yes! I would like to learn more"
            caption1style={style.BUTTON.caption1}
          />

          <Text style={style.TEXT}>
            <a href="#">No Thanks! I don't want this amazing opportunity</a>
          </Text>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
