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

import { color } from '../../constants/style';

export const Wrapper = styled('div')<{open: boolean}>`
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  background-color: white;
  position: fixed;
  top: 60px;
  right: 10px;
  display: inline-flex;
  padding: 9px 16px;
  box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.38);
  z-index: 2;
  transform: translateY(${props => props.open ? '0' : '-60px'});
  transition: transform 225ms cubic-bezier(0, 0, 0.2, 1) 0ms;
`;

export const InputWrapper = styled.div`
  width: 230px;
  height: 32px;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  overflow: hidden;
  background-color: ${color["light-gray"]};
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
`;

export const Input = styled.input`
  background-color: ${color["light-gray"]};
  outline: none;
  border: none;
  width: auto;
  height: 32px;
  box-sizing: border-box;
  padding: 0;
  flex: 1 2 auto;
`;

export const ResultInfo = styled.span`
  display: block;
  flex: 1 1 auto;
`;

export const ArrowButton = styled('button')<{variant: string}>`
  height: 32px;
  width: 30px;
  outline: none;
  border: none;
  background-color: ${color["light-gray"]};
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  ${props => props.variant === 'top' ? css`
    margin-left: 1px;
    :after {
      content: '';
      width: 0; 
      height: 0; 
      border-left: 5px solid transparent;
      border-right: 5px solid transparent;
      border-bottom: 5px solid black;
      position: absolute;
    }
    :hover:after {
      border-bottom: 5px solid ${color.black38};
    }
  ` : css`
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    margin-left: 1px;
    :after {
      content: '';
      width: 0; 
      height: 0; 
      border-left: 5px solid transparent;
      border-right: 5px solid transparent;
      border-top: 5px solid black;
      position: absolute;
    }
    :hover:after {
      border-top: 5px solid ${color.black38};
    }
  `}
`;
