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,
  List,
  ListItem,
} from "@sc/plugins/webcomponents/v2";
import { IconTypes } from "@sc/plugins/webcomponents/v2/Icon";

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: 700, margin: "0 auto" }}>
            <Headline style={{ ...style.HEADLINE, fontSize: "30pt" }}>
              Pricing
            </Headline>
            <Text style={{ ...style.TEXT, padding: 20 }}>
              Since wire-frame renderings are relatively simple and fast to
              calculate, they are often used in good cases where a high screen
              needed
            </Text>
            <Grid spacing={5} style={{ marginTop: 40 }}>
              <GridItem xs={6}>
                <Container
                  style={{
                    borderRadius: 5,
                    backgroundColor: theme.backgroundColor,
                    padding: 40,
                  }}
                >
                  <Headline
                    style={{ ...style.HEADLINE, color: theme.foregroundColor }}
                  >
                    Beginner
                  </Headline>
                  <Headline
                    style={{ ...style.HEADLINE, color: theme.foregroundColor }}
                  >
                    $25.99
                  </Headline>
                  <Text style={{ ...style.TEXT, color: theme.foregroundColor }}>
                    per user per month
                  </Text>
                  <List style={style.LIST}>
                    <ListItem
                      style={{
                        ...style.LI.style,
                        color: theme.foregroundColor,
                      }}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      Auto update mode
                    </ListItem>
                    <ListItem
                      style={{
                        ...style.LI.style,
                        color: theme.foregroundColor,
                      }}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      Online operator 24/7
                    </ListItem>
                    <ListItem
                      style={{
                        ...style.LI.style,
                        color: theme.foregroundColor,
                      }}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      Internation posting
                    </ListItem>
                    <ListItem
                      style={{
                        ...style.LI.style,
                        color: theme.foregroundColor,
                      }}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      Unique newsletters all
                    </ListItem>
                    <ListItem
                      style={{
                        ...style.LI.style,
                        color: theme.foregroundColor,
                      }}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      20 Design Templates
                    </ListItem>
                  </List>
                  <Container style={{ textAlign: "center" }}>
                    <Button
                      style={{
                        ...style.BUTTON.style,
                        backgroundColor: theme.foregroundColor,
                        // 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: "#f5f5f5",
                    padding: 40,
                  }}
                >
                  <Headline style={style.HEADLINE}>Intermediate</Headline>
                  <Headline style={style.HEADLINE}>$69.50</Headline>
                  <Text style={{ ...style.TEXT }}>per user per month</Text>
                  <List style={style.LIST}>
                    <ListItem
                      style={style.LI.style}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      Auto update mode
                    </ListItem>
                    <ListItem
                      style={style.LI.style}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      Online operator 24/7
                    </ListItem>
                    <ListItem
                      style={style.LI.style}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      Internation posting
                    </ListItem>
                    <ListItem
                      style={style.LI.style}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      Unique newsletters all
                    </ListItem>
                    <ListItem
                      style={style.LI.style}
                      contentStyle={style.LI.contentStyle}
                      icon={IconTypes.Check}
                    >
                      20 Design Templates
                    </ListItem>
                  </List>

                  <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>
            </Grid>
          </Container>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
