import * as React from "react";
import { get } from "lodash";
import { BrowserRouter as Router } from "react-router-dom";

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,
  Navigation,
} from "@sc/plugins/webcomponents/v2";
import {
  NavigationLayouts,
  ItemTypes,
} from "@sc/plugins/webcomponents/v2/xNavigation/types";
import { themeSettings, folder } from "@sc/plugins/webcomponents/v2/theme";

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"),
          }}
        >
          <Router>
            <Navigation
              layout={NavigationLayouts.ONE}
              logo={theme.logoLight}
              logoHref={`/${folder}`}
              items={[
                {
                  caption: "Consulting",
                  href: "./consulting",
                  type: ItemTypes.TEXT,
                },
                {
                  caption: "Speaking",
                  href: "./speaking",
                  type: ItemTypes.TEXT,
                },
                {
                  caption: "Training",
                  href: "./training",
                  type: ItemTypes.TEXT,
                },
                { caption: "Podcast", href: "./podcast", type: ItemTypes.TEXT },
              ]}
              linkStyle={{
                color: "white",
                listStyle: "none",
                display: "inline-block",
                padding: "20px 30px",
                fontFamily: "Roboto",
              }}
              style={{ padding: 20 }}
            />
          </Router>
        </Container>
      </Section>
    </Block>
  );
};

export default Layout;
