import styled, { css } from "styled-components";

import { Small } from "../../base";

import { theme, getColor, getMargin } from "../../styled-config";

const color = (props) =>
  css`
    color: ${getColor(props, "formText", "colorMuted")};
  `;

const inline = (props) => {
  if (props.inline) {
    return css`
      display: inline-flex;
    `;
  }

  return css`
    display: block;
  `;
};

const FormText = styled(Small)`
  display: flex;
  font-family: Montserrat;
  margin-top: ${(props) => getMargin(props, "formText", "top")};
  box-sizing: border-box;
  ${(props) => color(props)};
  ${(props) => inline(props)};
`;

FormText.defaultProps = {
  theme,
};

export { FormText };
