labyrinth-frontend/src/MessageBanner.tsx

16 lines
430 B
TypeScript
Raw Permalink Normal View History

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