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,
  Button,
  FormBuilder,
  Grid,
  GridItem,
  FormField,
} from "@sc/plugins/webcomponents/v2";
import { FormFieldTypes } from "@sc/modules/v2/CRUD/FormBuilder/types";

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} style={{}}>
              <Container
                style={{
                  padding: 100,
                  backgroundColor: theme.backgroundColor,
                }}
              >
                <Headline style={style.HEADLINE}>Sign in</Headline>

                <FormField
                  style={{ ...style.FORM_FIELD.style, marginTop: 20 }}
                  inputStyle={style.FORM_FIELD.inputStyle}
                  type={FormFieldTypes.TEXT}
                  placeholder="First Name"
                />

                <FormField
                  style={style.FORM_FIELD.style}
                  inputStyle={style.FORM_FIELD.inputStyle}
                  type={FormFieldTypes.TEXT}
                  placeholder="Email"
                />

                <Button
                  style={{ ...style.BUTTON.style }}
                  caption1="Send"
                  caption1style={style.BUTTON.caption1}
                />
              </Container>
            </GridItem>
            <GridItem xs={6}></GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
