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,
} 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"),
          }}
        >
          <Headline style={style.HEADLINE}>
            Got some ideas for a project?
          </Headline>
          <Headline style={style.HEADLINE}>
            Drop us a line, be glad to hear from you
          </Headline>
          <FormBuilder
            style={{ marginTop: 40 }}
            data={[
              {
                type: FormFieldTypes.SELECT,
                name: "subject",
                placeholder: "What kind of project",
                options: [
                  { id: "id", name: "name", value: "Test" },
                  { id: "id", name: "name", value: "Test" },
                  { id: "id", name: "name", value: "Test" },
                  { id: "id", name: "name", value: "Test" },
                ],
                style: style.FORM_FIELD.style,
                inputStyle: style.FORM_FIELD.inputStyle,
              },
              {
                type: FormFieldTypes.TEXT,
                name: "company",
                placeholder: "Name of company",
                style: style.FORM_FIELD.style,
                xs: 6,
                inputStyle: style.FORM_FIELD.inputStyle,
              },
              {
                type: FormFieldTypes.TEXT,
                name: "name",
                placeholder: "Your name",
                style: style.FORM_FIELD.style,
                xs: 6,
                inputStyle: style.FORM_FIELD.inputStyle,
              },
              {
                type: FormFieldTypes.TEXT,
                name: "email",
                placeholder: "Email",
                style: style.FORM_FIELD.style,
                xs: 6,
                inputStyle: style.FORM_FIELD.inputStyle,
              },
              {
                type: FormFieldTypes.TEXT,
                name: "phone",
                placeholder: "Phone number",
                style: style.FORM_FIELD.style,
                xs: 6,
                inputStyle: style.FORM_FIELD.inputStyle,
              },
              {
                type: FormFieldTypes.CHECKBOX,
                name: "terms",
                label:
                  "The goal is to facilitate usability and efficiency as much as possible.  Common elements found in interface design are action buttons, text fields, check boxes, radio buttons and drop-down menus",
                placeholder: "Terms",
                style: style.FORM_FIELD.style,
                inputStyle: style.FORM_FIELD.inputStyle,
                labelStyle: style.FORM_FIELD.labelStyle,
              },
            ]}
          />
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
