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 { ImagePlaceholder, ImagePlaceholderTypes } from "../../Placeholders";

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

import {
  Block,
  Section,
  Headline,
  Text,
  Container,
  Grid,
  GridItem,
  Icon,
} from "@sc/plugins/webcomponents/v2";
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"),
          }}
        >
          <Grid spacing={10}>
            <GridItem xs={7}>
              <Icon
                type={IconTypes.FormatQuote}
                style={{ fontSize: "46pt", textAlign: "center", color: "#999" }}
              />
              <Headline style={style.HEADLINE}>
                "{startCase(lorem.generateSentences(2))}"
              </Headline>
              <Text style={style.TEXT}>
                - {startCase(lorem.generateWords(2))}
              </Text>
            </GridItem>
            <GridItem xs={5}>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  maxWidth: 350,
                  height: 250,
                  margin: "0 auto",
                }}
              />
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
