import { useTheme } from "@mui/material";
import CustomButton from "../CustomButton";


interface Props {
    children?: React.ReactNode;
    isSelected?: boolean;
    isSelectedModal?: boolean;
    onClick: () => void;
}

export default function SelectableButton({ children, isSelected = false, isSelectedModal = false, onClick }: Props) {
    const theme = useTheme();

    return (
        <CustomButton
            onClick={onClick}
            sx={{
                backgroundColor: isSelected || isSelectedModal ? theme.palette.brightPurple.main : theme.palette.background.default,
                border: isSelected || isSelectedModal ? "none" : `1px solid ${theme.palette.grey2.main}`,
                color: isSelected || isSelectedModal ? "white" : theme.palette.grey2.main,
                py: isSelected || isSelectedModal ? "12px" : "11px",
                width: "auto",
                flex: "1 1 auto",
                "&:hover": {
                    backgroundColor: theme.palette.lightPurple.main
                },
            }}
        >
            {children}
        </CustomButton>
    );
}