import Button from '@mui/material/Button';
import { Loader } from '../Loader';
import { styled } from '../styled';
import { ButtonVariants } from './enums';
const getLoaderColor = (color, variant, theme, isDisabled) => {
    if (isDisabled) {
        return theme.palette.grey[500];
    }
    const variantColorMap = {
        contained: theme.palette.primary.contrastText,
        link: theme.palette.components.link.main,
        outlined: theme.palette[color][900],
        text: theme.palette[color][900],
        light: theme.palette[color][900],
    };
    return variantColorMap[variant];
};
export const StyledButton = styled(Button) `
  min-width: ${({ variant }) => variant === ButtonVariants.Link ? 'auto' : ''};
  padding: ${({ variant }) => (variant === ButtonVariants.Link ? 0 : '')};

  :active {
    box-shadow: none;
  }
`;
export const StyledLoader = styled(Loader, {
    shouldForwardProp: (prop) => !['$color', '$variant', '$isDisabled'].includes(prop),
}) `
  position: absolute;

  color: ${({ $color, $variant, theme, $isDisabled }) => getLoaderColor($color, $variant, theme, $isDisabled)};

  ${({ theme }) => theme.breakpoints.down('sm')} {
    width: 20px;
    height: 20px;
  }
`;
