/******************************************************************************** * Copyright (c) 2023 Precies. Software Ltd and others * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * SPDX-License-Identifier: EPL-2.0 ********************************************************************************/ import { FunctionComponent, useEffect } from 'react'; import { Dialog, DialogTitle, DialogContent, Button, DialogContentText, DialogActions } from '@mui/material'; export const InfoDialog: FunctionComponent = props => { useEffect(() => { document.addEventListener('keydown', handleEnter); return () => document.removeEventListener('keydown', handleEnter); }, []); const handleEnter = (event: KeyboardEvent): void => { if (event.code === 'Enter') { props.handleCloseDialog(); } }; return Info {props.infoMessage} ; }; export interface InfoDialogProps { infoMessage: string; isInfoDialogOpen: boolean; handleCloseDialog: () => void; }