// @flow
import type { StatelessFunctionalComponent } from 'react';
import styled from 'styled-components';
import type { SpanProps } from './span.proptypes';
import {
  getForegroundColor,
  getSpanFontSize,
  getSpanFontFamily,
  getSpanFontWeight,
  getDisplay,
} from './span.css-rules';
import {
  getTextAlign,
  getFontStyle,
  getTextTransform,
  underlineRules,
} from '../../../mixins/typography';
import { getSpacingRules } from '../../../mixins/spacing';

export const Span: StatelessFunctionalComponent<SpanProps> = styled.span`
  ${underlineRules}
  display: ${getDisplay};
  color: ${getForegroundColor};
  text-align: ${getTextAlign};
  font-size: ${getSpanFontSize};
  font-style: ${getFontStyle};
  font-family: ${getSpanFontFamily};
  font-weight: ${getSpanFontWeight};
  text-transform: ${getTextTransform};
  &&& {
    ${getSpacingRules}
  }
`;

Span.displayName = 'Span';
