import styled from 'styled-components/macro'

export const Wrapper = styled.div`
  position: relative;
  display: flex;
  align-items: center;
`

type WorldIconProps = {
  active?: boolean,
}

export const WorldIcon = styled.button<WorldIconProps>`
  display: block;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  outline: none;
  background-image: url(/images/worldIcon.svg);
  background-position-x: -1px;
  cursor: pointer;

  :hover {
    opacity: 1;
  }

  ${({ active }) => (
    active
      ? 'opacity: 1;'
      : 'opacity: 0.7;'
  )}
`

export const LangsList = styled.ul`
  display: flex;
  flex-wrap: wrap;
  width: 96px;
  position: absolute;
  background-color: #666666;
  box-shadow: 0 2px 5px rgba(0,0,0,.5);
  border-radius: 2px;
  right: -92%;
  top: calc(100% + 4px);

  :before {
    content: '';
    width: 12px;
    height: 12px;
    transform: translateY(-50%) rotate(45deg);
    position: absolute;
    right: 19px;
    background-color: #666666;
    z-index: 0;
  }
`

export const LangsItem = styled.li`
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  z-index: 1;
  border-radius: 2px;

  :hover {
    background-color: #999999;
    cursor: pointer;
  }
`

export const FlagIcon = styled.span`
  display: inline-block;
  width: 28px;
  height: 16px;
  transition: .3s;
`
