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

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

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

const color = (props) =>
  props.disabled &&
  css`
    color: ${getColor(props, "formCheckInput", "colorDisabled")};
    & + label {
      color: ${getColor(props, "formCheckInput", "colorDisabledLabel")};
    }
  `;

const FormCheckInput = styled(Input)`
  height: ${(props) => getHeight(props, "formCheckInput", "height")};
  width: ${(props) => getWidth(props, "formCheckInput", "width")};
  cursor: pointer;
  vertical-align: sub;
  margin-top: ${(props) => getMargin(props, "formCheckInput", "top")};
  margin-right: ${(props) => getMargin(props, "formCheckInput", "right")};
  box-sizing: border-box;
  ${(props) => color(props)};
`;

FormCheckInput.defaultProps = {
  theme,
};

export { FormCheckInput };
