// material-ui
import {useState, useEffect} from 'react';
import { useIntl } from 'react-intl';
import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png';
import {
    Button,
    Typography
}from '@mui/material';

// ==============================|| EVENT TABLE ||============================== //

export function IAmSmartButton({ label, onClickFun, fullWidth }) {
    const intl = useIntl();
    const [_label, set_label] = useState("");
   
    useEffect(()=>{
        set_label(label);
    }
    ,[label]);


    const doOnClick=()=>{
        onClickFun();
    }

    return (
        <Button onClick={()=>doOnClick()}  sx={{textTransform: 'none'}} color="iAmSmart" fullWidth={fullWidth} size="large" variant="outlined" startIcon={<img src={iAmSmartICon} alt={intl.formatMessage({ id: 'iAmSmartAlt' })} width="30" />}>
        <Typography variant="h5">
            {_label}
        </Typography>
      </Button>  
    );
}
