import { compileClassNames } from '@zohodesk/utils';
/**
 * container classname based on js state
 * @param {object} props text props
 * @param {object} style text syle
 * @returns {string} classnames string with space separate
 */

export default function (props, style) {
  const {
    textEllipsis,
    wordWrap,
    startIcon,
    endIcon,
    size,
    stretch,
    auto,
    align,
    direction,
    weight,
    transform,
    color,
    decoration,
    decorationColor,
    type,
    level,
    lineHeight,
    letterSpacing,
    indent,
    children
  } = props;
  const hasIcon = startIcon || endIcon;
  return compileClassNames({
    [style.base]: true,
    [style.ellipsis]: !!textEllipsis,
    [style.wrap]: !!wordWrap,
    [style[size]]: !!size,
    [style.stretch]: !!stretch,
    [style.auto]: !!auto,
    [style[direction]]: !!direction,
    [style[align]]: !!align,
    [style[weight]]: !!weight,
    [style[transform]]: !!transform,
    [style[color]]: !!color,
    [style[lineHeight]]: !!lineHeight,
    [style[letterSpacing]]: !!letterSpacing,
    [style[decoration]]: !!decoration,
    [style[decorationColor]]: !!decorationColor,
    [style[indent]]: !!indent,
    [style[type]]: !!type,
    [style[level]]: !!level,
    [style.content]: !!(children || hasIcon)
  });
}