2023-04-17 02:43:36 +02:00
|
|
|
import {actionClosedMessageBanner} from "./state/action.ts";
|
2023-04-17 01:19:42 +02:00
|
|
|
|
|
|
|
export default function MessageBanner({state, dispatch}) {
|
|
|
|
function handleClose() {
|
2023-04-17 02:43:36 +02:00
|
|
|
dispatch(actionClosedMessageBanner());
|
2023-04-17 01:19:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!!state.errorMessage) {
|
|
|
|
return (<div className={"message-banner"}>
|
|
|
|
{state.errorMessage}
|
|
|
|
<button onClick={handleClose}>Dismiss message</button>
|
|
|
|
</div>);
|
|
|
|
}
|
|
|
|
return <></>;
|
|
|
|
}
|