import { WarningRounded } from '@mui/icons-material'
import { type BoxProps, Typography } from '@mui/material'
import { AlertMessage } from './AlertMessage.js'

interface ServerErrorMessageProps extends BoxProps {
  errorMsg?: String
}

export const ServerErrorMessage: React.FC<ServerErrorMessageProps> = ({
  errorMsg,
  ...props
}) => {
  return (
    <AlertMessage
      severity="warning"
      icon={<WarningRounded />}
      title={
        <Typography
          variant="body2"
          sx={{
            color: 'text.primary',
          }}
        >
          {errorMsg}
        </Typography>
      }
      multiline
      {...props}
    />
  )
}
