import styled, { css }from 'styled-components';

const position: {[index: string]:any} = {
  left: css`
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
  `,
  top: css`
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
  `,
  right: css`
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
  `,
  bottom: css`
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
  `,
};

const close: {[index: string]:any} = {
  left: css`
    transform: translate(-267px, 0);
  `,
  top: css`
    transform: translate(0, -267px);
  `,
  right: css`
    transform: translate(267px, 0);
  `,
  bottom: css`
    transform: translate(0, 267px);
  `,
};

export const Slide = styled('div')<{open: boolean, anchor: string}>`
  position: fixed;
  transition: transform 225ms cubic-bezier(0, 0, 0.2, 1) 0ms;
  z-index: 3;
  background-color: white;

  ${props => position[props.anchor]}

  ${props => props.open ? css`
    transform: translate(0, 0);
  ` : close[props.anchor]
  }
`;

export const Container = styled.div`
  min-width: 267px;
  min-height: 267px;
  height: 100%;
  width: 100%;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.24);
`;
