import React from 'react';
import styled from 'styled-components';

import v from '../../styles/Variables';

interface Props {
  background?: string;
  fontColor?: string;
  title: string;
  left?: string;
  top?: string;
}

interface Styles {
  background: string;
  fontColor: string;
  left: string;
  top: string;
}

const Badge = ({ background = v.colors.dark, fontColor = v.colors.light, title, top = '5px', left = '5px' }: Props) => {
  return (
    <BadgeStyle background={background} fontColor={fontColor} top={top} left={left}>
      &nbsp;
      <strong>{title}</strong>
      &nbsp;
    </BadgeStyle>
  );
};

export default Badge;

/* styles */
const BadgeStyle = styled.span<Styles>`
  position: absolute;
  font-size: 12px;
  background: ${({ background }) => background};
  color: ${({ fontColor }) => fontColor};
  padding: 0 3px;
  line-height: 22px;
  border-radius: 300px;
  min-width: 22px;
  min-height: 22px;
  text-align: center;
  display: inline-block;
  left: ${({ left }) => left};
  top: ${({ top }) => top};
  white-space: nowrap;
  overflow: hidden;
`;
