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 { ImagePlaceholder, ImagePlaceholderTypes } from "../../Placeholders";

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>
            <GridItem xs={6}>
              <ImagePlaceholder
                style={{
                  position: "relative",
                  top: "50%",
                  transform: "translateY(-50%)",
                  width: 300,
                  margin: "0 auto",
                }}
                type={ImagePlaceholderTypes.MOBILE03}
              />
            </GridItem>
            <GridItem xs={6}>
              <Container style={{ padding: 110 }}>
                <Headline
                  name="Main Headline"
                  id="main_headline"
                  style={{
                    ...style.HEADLINE,
                    ...get(content, "main_headline.style", {}),
                  }}
                >
                  01
                </Headline>
                <Text
                  name="Sub Headline"
                  id="sub_headline"
                  style={{
                    ...style.TEXT,
                    ...get(content, "sub_headline.style", {}),
                  }}
                >
                  Modern design incorporates various devices such panels, hover
                  effects, and carousels
                </Text>
                <Headline
                  name="Main Headline"
                  id="main_headline"
                  style={{
                    ...style.HEADLINE,
                    ...get(content, "main_headline.style", {}),
                  }}
                >
                  02
                </Headline>
                <Text
                  name="Sub Headline"
                  id="sub_headline"
                  style={{
                    ...style.TEXT,
                    ...get(content, "sub_headline.style", {}),
                  }}
                >
                  Modern design incorporates various devices such panels, hover
                  effects, and carousels
                </Text>
                <Headline
                  name="Main Headline"
                  id="main_headline"
                  style={{
                    ...style.HEADLINE,
                    ...get(content, "main_headline.style", {}),
                  }}
                >
                  03
                </Headline>
                <Text
                  name="Sub Headline"
                  id="sub_headline"
                  style={{
                    ...style.TEXT,
                    ...get(content, "sub_headline.style", {}),
                  }}
                >
                  Modern design incorporates various devices such panels, hover
                  effects, and carousels
                </Text>
              </Container>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
