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 fbsettings from "@sc/plugins/webcomponents/v2/FacebookLogin/settings";
import googlesettings from "@sc/plugins/webcomponents/v2/GoogleLogin/settings";

import {
  Block,
  Section,
  Headline,
  Text,
  Container,
  FacebookLogin,
  GoogleLogin,
} from "@sc/plugins/webcomponents/v2";

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"),
          }}
        >
          <Container
            style={{
              maxWidth: 500,
              backgroundColor: theme.backgroundColor,
              borderRadius: 8,
              margin: "0 auto",
              padding: "50px 90px",
            }}
          >
            <Container style={{ maxWidth: 350, margin: "0 auto" }}>
              <Headline style={style.HEADLINE}>Sign up</Headline>
              <Text style={style.TEXT}>
                Sign up for great features and new products that are waiting for
                you
              </Text>
              <Container style={{ marginTop: 50 }}>
                <FacebookLogin
                  {...fbsettings.default}
                  style={{ marginTop: 5, width: "100%" }}
                />
                <GoogleLogin
                  {...googlesettings.default}
                  style={{ marginTop: 5, width: "100%" }}
                />
                <Text style={{ ...style.TEXT, marginTop: 80 }}>
                  Already have an account?{" "}
                  <a href="#" style={{ color: theme.foregroundColor }}>
                    Sign in
                  </a>
                </Text>
              </Container>
            </Container>
          </Container>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
