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 { IconTypes } from "@sc/plugins/webcomponents/v2/Icon";
import { ImagePlaceholder, ImagePlaceholderTypes } from "../../Placeholders";

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

import {
  Block,
  Section,
  Headline,
  Text,
  Container,
  Image,
  Grid,
  GridItem,
  Icon,
  Shapes,
} from "@sc/plugins/webcomponents/v2";
import { ShapeTypes } from "@sc/plugins/webcomponents/v2/Shapes/component";
import { getClipPath, ClipPathTypes } from "@sc/plugins/utilities/clipPaths";

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>
          <Text style={style.TEXT}>{lorem.generateParagraphs(1)}</Text>
          <Grid spacing={5} style={{ marginTop: 30 }}>
            <GridItem xs={4}>
              <Icon
                type={IconTypes.FormatQuote}
                style={{ fontSize: "36pt", textAlign: "center", color: "#999" }}
              />
              <Text style={style.TEXT}>{lorem.generateSentences(1)}</Text>
              <Container
                style={{
                  height: 50,
                  margin: "0 auto",
                  marginTop: 20,
                  width: 50,
                }}
              >
                <Shapes
                  data={[
                    {
                      type: ShapeTypes.CIRCLE,
                      style: { fill: "green", r: 7, cx: 47, cy: 15 },
                      after: true,
                    },
                  ]}
                >
                  <ImagePlaceholder
                    type={ImagePlaceholderTypes.NONE}
                    style={{
                      backgroundColor: theme.backgroundColor,
                      width: 50,
                      height: 50,
                      clipPath: getClipPath({ type: ClipPathTypes.CIRCLE }),
                    }}
                  />
                </Shapes>
              </Container>
              <Text style={style.TEXT}>
                - {startCase(lorem.generateWords(2))}
              </Text>
            </GridItem>
            <GridItem xs={4}>
              <Icon
                type={IconTypes.FormatQuote}
                style={{ fontSize: "36pt", textAlign: "center", color: "#999" }}
              />
              <Text style={style.TEXT}>{lorem.generateSentences(1)}</Text>
              <Container
                style={{
                  height: 50,
                  margin: "0 auto",
                  marginTop: 20,
                  width: 50,
                }}
              >
                <Shapes
                  data={[
                    {
                      type: ShapeTypes.CIRCLE,
                      style: { fill: "green", r: 7, cx: 47, cy: 15 },
                      after: true,
                    },
                  ]}
                >
                  <ImagePlaceholder
                    type={ImagePlaceholderTypes.NONE}
                    style={{
                      backgroundColor: theme.backgroundColor,
                      width: 50,
                      height: 50,
                      clipPath: getClipPath({ type: ClipPathTypes.CIRCLE }),
                    }}
                  />
                </Shapes>
              </Container>
              <Text style={style.TEXT}>
                - {startCase(lorem.generateWords(2))}
              </Text>
            </GridItem>
            <GridItem xs={4}>
              <Icon
                type={IconTypes.FormatQuote}
                style={{ fontSize: "36pt", textAlign: "center", color: "#999" }}
              />
              <Text style={style.TEXT}>{lorem.generateSentences(1)}</Text>
              <Container
                style={{
                  height: 50,
                  margin: "0 auto",
                  marginTop: 20,
                  width: 50,
                }}
              >
                <Shapes
                  data={[
                    {
                      type: ShapeTypes.CIRCLE,
                      style: { fill: "green", r: 7, cx: 47, cy: 15 },
                      after: true,
                    },
                  ]}
                >
                  <ImagePlaceholder
                    type={ImagePlaceholderTypes.NONE}
                    style={{
                      backgroundColor: theme.backgroundColor,
                      width: 50,
                      height: 50,
                      clipPath: getClipPath({ type: ClipPathTypes.CIRCLE }),
                    }}
                  />
                </Shapes>
              </Container>
              <Text style={style.TEXT}>
                - {startCase(lorem.generateWords(2))}
              </Text>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
