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

import { style } from "./style";
import { default as defaultData } from "./data.json";
import { ImagePlaceholder, ImagePlaceholderTypes } from "../../Placeholders";

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

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

import {
  Block,
  Section,
  Headline,
  Text,
  Container,
  Button,
  Divider,
  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(4))}
          </Headline>
          <Divider
            style={{ margin: "30px auto", width: 100 }}
            color={theme.backgroundColor}
            size={3}
          />
          <Grid
            spacing={2}
            style={{ marginTop: 40 }}
            justify="center"
            direction="row"
            // alignItems="center"
          >
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
            <GridItem>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                  width: 175,
                  height: 125,
                }}
              />
              <Text style={style.TEXT}>{lorem.generateWords(5)}</Text>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
