const fontVariant = (variant: string) => variant && `sentico-sans-${variant}`;
const pxToEm = (size: number) => size / 16;

const fontPropertiesFactory = (props: any, defaultProps: any) => {
  const { fontColor, fontDimension, variant, margin } = props;
  const { defaultColor, defaultFontSize, defaultVariant, defaultMargin } = defaultProps;

  return `
    font-family: ${fontVariant(variant) || fontVariant(defaultVariant)};
    font-size: ${pxToEm(fontDimension) || pxToEm(defaultFontSize)}em;
    color: ${fontColor || defaultColor};
    margin: ${margin || defaultMargin};
    font-weight: 500;
  `;
};

export default {
  fontVariant,
  pxToEm,
  fontPropertiesFactory,
};
