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: 980, margin: "0 auto" }}>
            <Grid spacing={2} style={{ marginTop: 40 }}>
              <GridItem xs={4}>
                <Container
                  style={{
                    borderRadius: 5,
                    backgroundColor: "#f5f5f5",
                    padding: 30,
                  }}
                >
                  <Text style={style.TEXT}>Intermediate</Text>
                  <Headline style={style.HEADLINE}>$29/mon.</Headline>
                  <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>
              <GridItem xs={4}>
                <Container
                  style={{
                    borderRadius: 5,
                    backgroundColor: theme.backgroundColor,
                    padding: 30,
                  }}
                >
                  <Text style={{ ...style.TEXT, color: theme.foregroundColor }}>
                    Medium
                  </Text>
                  <Headline
                    style={{ ...style.HEADLINE, color: theme.foregroundColor }}
                  >
                    $35/mon.
                  </Headline>
                  <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={4}>
                <Container
                  style={{
                    borderRadius: 5,
                    backgroundColor: "#f5f5f5",
                    padding: 30,
                  }}
                >
                  <Text style={style.TEXT}>Pro</Text>
                  <Headline style={style.HEADLINE}>$67/mon.</Headline>
                  <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>

            <Text style={{ ...style.TEXT, marginTop: 30 }}>
              Limited offer, save 20% for annual plan only till 30 of March
            </Text>
          </Container>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
