import * as React from "react";
import { get, startCase, uniqueId } 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,
  Image,
} from "@sc/plugins/webcomponents/v2";

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"),
          }}
        >
          <Container style={{ float: "right", maxWidth: 500 }}>
            <Container style={{ textAlign: "center" }}>
              <Image
                src={theme.logoLight}
                style={{ maxWidth: 200, padding: 20 }}
              />
            </Container>
            <Headline
              style={{ ...style.HEADLINE, color: theme.highlightColor }}
            >
              Free Masterclass
            </Headline>
            <Headline style={style.SUBHEADLINE}>
              Learn How to {startCase(lorem.generateWords(12))}
            </Headline>
            <Button
              style={style.BUTTON.style}
              caption1="Join the Masterclass Now"
              caption1style={style.BUTTON.caption1}
            />
            <Text style={style.TEXT}>* No credit card required</Text>
          </Container>
          <div style={{ clear: "both" }} />
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
