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

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

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

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

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

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"),
          }}
        >
          <Grid spacing={10}>
            <GridItem xs={6}>
              <Container
                style={{
                  padding: 80,
                  borderRadius: 5,
                  backgroundColor: "#EEE",
                }}
              >
                <ImagePlaceholder
                  type={ImagePlaceholderTypes.NONE}
                  style={{
                    backgroundColor: theme.backgroundColor,
                    width: "85%",
                    margin: "0 auto",
                    height: 250,
                  }}
                />
                <Headline style={{ ...style.HEADLINE }}>
                  Super fast and reliable
                </Headline>
                <Text style={{ ...style.TEXT }}>
                  It's true. Getting results is much easier than you think. The
                  truth is most people simply don't know
                </Text>
                <Container style={{ textAlign: "center" }}>
                  <Button
                    style={{
                      ...style.BUTTON.style,
                      border: `1px solid #CCC`,
                    }}
                    caption1="Start"
                    caption1style={style.BUTTON.caption1}
                  />
                </Container>
              </Container>
            </GridItem>
            <GridItem xs={6}>
              <Container
                style={{
                  padding: 80,
                  borderRadius: 5,
                  backgroundColor: theme.backgroundColor,
                }}
              >
                <ImagePlaceholder
                  type={ImagePlaceholderTypes.NONE}
                  style={{
                    backgroundColor: theme.foregroundColor,
                    width: "85%",
                    margin: "0 auto",
                    height: 250,
                  }}
                />
                <Headline
                  style={{ ...style.HEADLINE, color: theme.foregroundColor }}
                >
                  Super fast and reliable
                </Headline>
                <Text style={{ ...style.TEXT, color: theme.foregroundColor }}>
                  It's true. Getting results is much easier than you think. The
                  truth is most people simply don't know
                </Text>
                <Container style={{ textAlign: "center" }}>
                  <Button
                    style={style.BUTTON.style}
                    caption1="Start"
                    caption1style={style.BUTTON.caption1}
                  />
                </Container>
              </Container>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
