import * as React from "react";
import { get } from "lodash";
import Lorem from "react-lorem-component";

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,
  Grid,
  GridItem,
  List,
  ListItem,
} from "@sc/plugins/webcomponents/v2";
import { ImagePlaceholder, ImagePlaceholderTypes } from "../../Placeholders";
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={8}>
            <GridItem xs={4}>
              <ImagePlaceholder
                type={ImagePlaceholderTypes.NONE}
                style={{
                  backgroundColor: theme.backgroundColor,
                }}
              />
            </GridItem>
            <GridItem xs>
              <Headline style={style.HEADLINE}>Module Title</Headline>
              <Text style={style.TEXT}>
                <Lorem count={1} />
              </Text>
              <Grid>
                <GridItem xs={6}>
                  <List
                    data={[
                      {
                        caption: lorem.generateSentences(1),
                        style: style.LISTITEM.style,
                        iconStyle: style.LISTITEM.iconStyle,
                        contentStyle: style.LISTITEM.contentStyle,
                        icon: IconTypes.CheckCircleOutline,
                      },
                      {
                        caption: lorem.generateSentences(1),
                        style: style.LISTITEM.style,
                        iconStyle: style.LISTITEM.iconStyle,
                        contentStyle: style.LISTITEM.contentStyle,
                        icon: IconTypes.CheckCircleOutline,
                      },
                      {
                        caption: lorem.generateSentences(1),
                        style: style.LISTITEM.style,
                        iconStyle: style.LISTITEM.iconStyle,
                        contentStyle: style.LISTITEM.contentStyle,
                        icon: IconTypes.CheckCircleOutline,
                      },
                    ]}
                  />
                </GridItem>
                <GridItem xs={6}>
                  <List
                    data={[
                      {
                        caption: lorem.generateSentences(1),
                        style: style.LISTITEM.style,
                        iconStyle: style.LISTITEM.iconStyle,
                        contentStyle: style.LISTITEM.contentStyle,
                        icon: IconTypes.CheckCircleOutline,
                      },
                      {
                        caption: lorem.generateSentences(1),
                        style: style.LISTITEM.style,
                        iconStyle: style.LISTITEM.iconStyle,
                        contentStyle: style.LISTITEM.contentStyle,
                        icon: IconTypes.CheckCircleOutline,
                      },
                      {
                        caption: lorem.generateSentences(1),
                        style: style.LISTITEM.style,
                        iconStyle: style.LISTITEM.iconStyle,
                        contentStyle: style.LISTITEM.contentStyle,
                        icon: IconTypes.CheckCircleOutline,
                      },
                    ]}
                  />
                </GridItem>
              </Grid>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
