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,
  Image,
  Grid,
  GridItem,
  ListItem,
} 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={5}>
            <GridItem xs={6}>
              <ListItem
                icon={IconTypes.Security}
                iconStyle={{
                  paddingRight: 20,
                  fontSize: "56pt",
                  color: theme.backgroundColor,
                }}
              >
                <Headline style={style.SUBHEADLINE}>30 Day Guarantee</Headline>
                <Text style={style.TEXT}>{lorem.generateSentences(1)}</Text>
              </ListItem>
            </GridItem>
            <GridItem xs={6}>
              <ListItem
                icon={IconTypes.Lock}
                iconStyle={{
                  paddingRight: 20,
                  fontSize: "56pt",
                  color: theme.backgroundColor,
                }}
              >
                <Headline style={style.SUBHEADLINE}>Secure Payment</Headline>
                <Text style={style.TEXT}>{lorem.generateSentences(1)}</Text>
              </ListItem>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
