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,
  Divider,
} 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"),
          }}
        >
          <Headline style={style.HEADLINE}>Module Title</Headline>
          <Divider
            style={{ margin: "30px auto", width: 100 }}
            color={theme.backgroundColor}
            size={3}
          />

          <List
            data={[
              {
                caption: lorem.generateSentences(2),
                style: style.LISTITEM.style,
                iconStyle: style.LISTITEM.iconStyle,
                contentStyle: style.LISTITEM.contentStyle,
                icon: IconTypes.CheckCircleOutline,
              },
              {
                caption: lorem.generateSentences(2),
                style: style.LISTITEM.style,
                iconStyle: style.LISTITEM.iconStyle,
                contentStyle: style.LISTITEM.contentStyle,
                icon: IconTypes.CheckCircleOutline,
              },
              {
                caption: lorem.generateSentences(2),
                style: style.LISTITEM.style,
                iconStyle: style.LISTITEM.iconStyle,
                contentStyle: style.LISTITEM.contentStyle,
                icon: IconTypes.CheckCircleOutline,
              },
              {
                caption: lorem.generateSentences(2),
                style: style.LISTITEM.style,
                iconStyle: style.LISTITEM.iconStyle,
                contentStyle: style.LISTITEM.contentStyle,
                icon: IconTypes.CheckCircleOutline,
              },
              {
                caption: lorem.generateSentences(2),
                style: style.LISTITEM.style,
                iconStyle: style.LISTITEM.iconStyle,
                contentStyle: style.LISTITEM.contentStyle,
                icon: IconTypes.CheckCircleOutline,
              },
            ]}
          />
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
