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

import { P } from '../../base';

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

const color = (props) => {
  if (props.loading) {
    return css`
      color: transparent;
    `;
  }

  return css``;
};

const CardText = styled(P)`
  margin-top: ${(props) => getMargin(props, 'cardText', 'top')};
  margin-bottom: ${(props) => getMargin(props, 'cardText', 'bottom')};
  &:last-child {
    margin-bottom: ${(props) => getMargin(props, 'cardText', 'lastChildBottom')};
  };
  ${(props) => color(props)};
`;

CardText.defaultProps = {
  theme,
};

export { CardText };
