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,
  Grid,
  GridItem,
} 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"),
          }}
        >
          <Headline style={{ ...style.HEADLINE }}>
            {startCase(lorem.generateWords(9))}?
          </Headline>
          <Headline style={{ ...style.SUBHEADLINE }}>
            {startCase(lorem.generateWords(9))}?
          </Headline>

          <Grid
            style={{
              width: 500,
              maxWidth: "100%",
              margin: "0 auto",
              marginTop: 40,
            }}
          >
            <GridItem xs={12} sm={6} style={{ textAlign: "center" }}>
              <Button
                style={{
                  ...style.BUTTON.style,
                  width: 200,
                  backgroundColor: "#5ec55e",
                }}
                caption1="Yes!"
                caption1style={style.BUTTON.caption1}
              />
            </GridItem>
            <GridItem xs={12} sm={6} style={{ textAlign: "center" }}>
              <Button
                style={{ ...style.BUTTON.style, width: 200 }}
                caption1="No!"
                caption1style={style.BUTTON.caption1}
              />
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
