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,
  Container,
  Navigation,
} from "@sc/plugins/webcomponents/v2";

import {
  NavigationLayouts,
  ItemTypes,
} from "@sc/plugins/webcomponents/v2/Navigation/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"),
          }}
        >
          <Navigation
            layout={NavigationLayouts.FOUR}
            items={[
              {
                caption: "Shop",
                href: "./shop",
                type: ItemTypes.TEXT,
              },
              {
                caption: "About",
                href: "./about",
                type: ItemTypes.TEXT,
              },
              {
                caption: "Blog",
                href: "./blog",
                type: ItemTypes.TEXT,
              },
              { caption: "Pricing", href: "./pricing", type: ItemTypes.TEXT },
              {
                caption: "Button",
                href: "./",
                type: ItemTypes.BUTTON,
                buttonSettings: { ...style.BUTTON },
              },
            ]}
            linkStyle={{
              color: "black",
              listStyle: "none",
              display: "inline-block",
              padding: "0 20px",
              fontFamily: theme.fontFamily,
            }}
            copyrightStyle={{
              padding: 20,
              fontFamily: theme.fontFamily,
              fontSize: "10pt",
            }}
          />
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
