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,
  Grid,
  GridItem,
} 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")
            maxWidth: 900,
          }}
        >
          <Grid spacing={5}>
            <GridItem xs={6}>
              <Container
                style={{
                  borderRadius: 5,
                  backgroundColor: "#f5f5f5",
                  padding: 75,
                }}
              >
                <Text style={style.TEXT}>Beginners</Text>
                <Headline style={style.HEADLINE}>$29</Headline>
                <Text style={style.TEXT}>
                  Ut enim ad minim veniam, quis nostrud exercitation ullamco
                  laboris nisi ut aliquip ex ea commodo consequat
                </Text>
                <Container style={{ textAlign: "center" }}>
                  <Button
                    style={{
                      ...style.BUTTON.style,
                      backgroundColor: "transparent",
                      border: `1px solid ${theme.backgroundColor}`,
                    }}
                    caption1="Purchase"
                    caption1style={{
                      ...style.BUTTON.caption1,
                      color: theme.backgroundColor,
                    }}
                  />
                </Container>
              </Container>
            </GridItem>
            <GridItem xs={6}>
              <Container
                style={{
                  borderRadius: 5,
                  backgroundColor: theme.backgroundColor,
                  padding: 75,
                }}
              >
                <Text style={{ ...style.TEXT, color: theme.foregroundColor }}>
                  Professional
                </Text>
                <Headline
                  style={{ ...style.HEADLINE, color: theme.foregroundColor }}
                >
                  $89
                </Headline>
                <Text style={{ ...style.TEXT, color: theme.foregroundColor }}>
                  Ut enim ad minim veniam, quis nostrud exercitation ullamco
                  laboris nisi ut aliquip ex ea commodo consequat
                </Text>
                <Container style={{ textAlign: "center" }}>
                  <Button
                    style={{
                      ...style.BUTTON.style,
                      backgroundColor: theme.foregroundColor,
                    }}
                    caption1="Purchase"
                    caption1style={{
                      ...style.BUTTON.caption1,
                      color: theme.backgroundColor,
                    }}
                  />
                </Container>
              </Container>
            </GridItem>
          </Grid>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
