import { useMemo } from 'react';
import { classNames } from '../../utils/classNames';
import { buttonClassnames, buttonColorClassnames } from '../constants';
import { ButtonColors, ButtonVariants } from '../enums';
export const useLogic = ({ loading, selected, variant = ButtonVariants.Contained, color = variant === ButtonVariants.Text
    ? ButtonColors.Grey
    : ButtonColors.Primary, disabled, className, }) => {
    const loadingIndicatorColor = useMemo(() => {
        if (variant !== ButtonVariants.Contained) {
            return 'primary';
        }
        return 'inverted';
    }, [variant]);
    const classnames = useMemo(() => classNames(buttonClassnames.root, buttonColorClassnames[color], className, {
        [buttonClassnames.loading]: loading,
        [buttonClassnames.disabled]: disabled,
        [buttonClassnames.selected]: selected,
    }), [loading, selected, color, className, disabled]);
    return { loadingIndicatorColor, classnames };
};
