// @flow
import type { StatelessFunctionalComponent } from 'react';
import styled from 'styled-components';
import type { TextProps } from './text.proptypes';
import { getSpacingRules } from '../../../mixins/spacing';
import { getStackeeRules } from '../../../mixins/stackee';
import {
  getTextAlign,
  getFontSize,
  getFontStyle,
  getFontFamily,
  getTextDecoration,
  getTextTransform,
  getFontWeight,
  getTabularStyles,
} from '../../../mixins/typography';
import { getForegroundColor } from '../../../mixins/branding';

export const Text: StatelessFunctionalComponent<TextProps> = styled.p`
  line-height: 1.4;
  margin: 0 0 1em 0;
  color: ${getForegroundColor};
  text-align: ${getTextAlign};
  font-size: ${getFontSize};
  font-style: ${getFontStyle};
  font-family: ${getFontFamily};
  font-weight: ${getFontWeight};
  text-decoration: ${getTextDecoration};
  text-transform: ${getTextTransform};
  ${getTabularStyles}
  &&& {
    ${getSpacingRules}
  }
  ${getStackeeRules}
`;

Text.displayName = 'Text';
