import styled from '@emotion/styled';
import { blue300, blue500, gray400, gray700 } from './colors_v2';
import { fontSizeMedium } from './dimensions';

export const BaseButton = styled.button<{}>`
  border: 1px solid transparent;
  border-radius: 2px;
  background: none;
  font-family: inherit;
  line-height: inherit;
  font-size: ${fontSizeMedium}px;
  color: ${blue500};
  display: flex;
  align-items: center;
  justify-content: center;
  &:hover {
    color: ${blue300};
    cursor: pointer;
  }
  :disabled:hover {
    cursor: default;
  }
  &:active, &:focus {
    outline: none;
    border: 1px solid ${blue500};
  }
  svg * {
    fill: currentColor;
  }
`

export const ClearButton = styled(BaseButton)``;

export const MinorButton = styled(BaseButton)`
  border: 1px solid ${blue500};
  background-color: inherit;
  &:hover {
    color: ${blue300};
    border-color: ${blue300};
  }
`;

export const MajorButton = styled(BaseButton)`
  border: 1px solid transparent;
  color: white;
  background-color: ${blue500};
  font-weight: 500;
  &:hover {
    color: white;
    background-color: ${blue300};
  }
`;

export const CornerButton = styled(MajorButton)`
  border: none;
  &:active {
    border: none;
  }
  &:focus {
    opacity: 0.7;
    border: none;
    outline: none;
  }
  border-top-right-radius: 0;
  background-color: ${gray400};
  padding: 8px 0 8px 14px;
  position: relative;
  &:hover {
    background-color: ${gray700};
    &:after {
      border-top-color: ${gray700};
    }
  }
  &:before {
    content: '';
    position: absolute;
    left: 100%;
    bottom: 24px;
    top: 0px;
    display: block;
    width: 24px;
    background-color: inherit;
    border-top-right-radius: inherit;
  }
  &:after {
    content: '';
    position: absolute;
    left: 100%;
    bottom: 0px;
    display: block;
    height: 24px;
    width: 24px;
    border-right: 24px solid transparent;
    border-top: 24px solid ${gray400};
  }
`;
