import React from "react";
import styled from "styled-components";
import { Link } from "@components/index";
import Icon, { IconType } from "@components/Icon";
import colors from "@theme/colors";
import breakpoints from "@theme/breakpoints";

const Columns = styled.div`
  display: flex;
  justify-content: space-between;

  & > div > div {
    margin-bottom: 1rem;
  }
`;

const Content = styled.div`
  display: flex;

  & > div:first-of-type {
    padding: 3rem 0;
    flex: 2 1;

    & > * {
      padding: 0 1.5rem;
    }
  }

  h4 {
    color: ${colors.lightBlue};
    padding: 1.5rem 0;
    text-align: center;
  }

  a {
    color: ${colors.white};
    display: block;
    text-decoration: underline;
    padding: 0.4rem 0;
    font-size: 0.8rem;

    &:hover {
      text-decoration: none;
    }
  }

  p {
    color: ${colors.white};
    margin: 0;
    padding: 0.4rem 0;
    font-size: 0.8rem;
  }
`;

const MarginSpace = styled.div`
  max-width: 67%;
  margin: auto;
`;

const Map = styled.div`
  flex: 1;

  @media screen and (max-width: ${breakpoints.mobile}) {
    display: none;
  }

  iframe {
    border: none;
  }
`;

const SomeContainer = styled.div`
  display: flex;
  flex-flow: column nowrap;
  justify-content: space-between;
  a {
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    margin-right: 0.5rem;

    color: inherit;
    text-decoration: none;

  }
  svg{
    width: 24px;
    height: 24px;
    fill: ${colors.white};
}
`;

const FooterContent: React.FC = () => (
  <Content>
    <div>
      <MarginSpace>
        <h4>Aalto-yliopiston Sähköinsinöörikilta ry</h4>
        <Columns>
          <div>
            <div>
              <p>TUAS-Talo</p>
              <p>Maarintie 8</p>
            </div>
            <div>
              <p>hallitus@sahkoinsinoorikilta.fi</p>
              <Link to="/yhteystiedot">Yhteystiedot</Link>
            </div>
          </div>
          <div>
            <Link to="https://api.sahkoinsinoorikilta.fi/members/application/">Jäseneksi</Link>
            <Link to="mailto:hallitus@sahkoinsinoorikilta.fi">Palaute</Link>
            <Link to="https://static.sahkoinsinoorikilta.fi">Dokumenttiarkisto</Link>
            <Link to="https://sik.kuvat.fi">Kuvagalleria</Link>
            <Link to="https://static.sahkoinsinoorikilta.fi/logot-ja-grafiikka/">Logot ja grafiikka</Link>
          </div>
          <div>
            <SomeContainer>
              <Icon name={IconType.Facebook} link="https://www.facebook.com/AaltoYliopistonSIK/" />
              <Icon name={IconType.Instagram} link="https://www.instagram.com/sahkoinsinoorikilta/" />
              <Icon name={IconType.LinkedIn} link="https://www.linkedin.com/groups/8103057/" />
            </SomeContainer>
          </div>
        </Columns>
      </MarginSpace>
    </div>

    <Map>
      <iframe
        title="Maarintalo 8 on Google Maps"
        // eslint-disable-next-line max-len
        src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1983.6122518000927!2d24.81667815176689!3d60.187150048900186!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x468df5eb3cb4ecf1%3A0x3480cbfeedcc07b6!2sMaarintie+8%2C+02150+Espoo!5e0!3m2!1sfi!2sfi!4v1542413548247"
        width="100%"
        height="100%"
      />
    </Map>
  </Content>
);

export default FooterContent;
