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

import { style } from "./style";
import { default as defaultData } from "./data.json";

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

import {
  Block,
  Section,
  Headline,
  Text,
  Container,
  Grid,
  GridItem,
} from "@sc/plugins/webcomponents/v2";
import { default as Icon, 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}>
          <Grid spacing={10}>
            <GridItem xs={4}>
              <Headline style={style.HEADLINE}>01</Headline>
              <Headline
                name="Main Headline"
                id="main_headline"
                style={{
                  ...style.ITEM_HEADLINE,
                  ...get(content, "main_headline.style", {}),
                }}
              >
                Modern design
              </Headline>
              <Text
                name="Sub Headline"
                id="sub_headline"
                style={{
                  ...style.TEXT,
                  ...get(content, "sub_headline.style", {}),
                }}
              >
                {get(content, "sub_headline.html", "...")}
              </Text>
            </GridItem>
            <GridItem xs={4}>
              <Headline style={style.HEADLINE}>02</Headline>
              <Headline
                name="Main Headline"
                id="main_headline"
                style={{
                  ...style.ITEM_HEADLINE,
                  ...get(content, "main_headline.style", {}),
                }}
              >
                Modern design
              </Headline>
              <Text
                name="Sub Headline"
                id="sub_headline"
                style={{
                  ...style.TEXT,
                  ...get(content, "sub_headline.style", {}),
                }}
              >
                {get(content, "sub_headline.html", "...")}
              </Text>
            </GridItem>
            <GridItem xs={4}>
              <Headline style={style.HEADLINE}>03</Headline>
              <Headline
                name="Main Headline"
                id="main_headline"
                style={{
                  ...style.ITEM_HEADLINE,
                  ...get(content, "main_headline.style", {}),
                }}
              >
                Modern design
              </Headline>
              <Text
                name="Sub Headline"
                id="sub_headline"
                style={{
                  ...style.TEXT,
                  ...get(content, "sub_headline.style", {}),
                }}
              >
                {get(content, "sub_headline.html", "...")}
              </Text>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
