import {actionClosedMessageBanner} from "./state/action.ts";

export default function MessageBanner({state, dispatch}) {
    function handleClose() {
        dispatch(actionClosedMessageBanner());
    }

    if (!!state.errorMessage) {
        return (<div className={"message-banner"}>
            {state.errorMessage}
            <button onClick={handleClose}>Dismiss message</button>
        </div>);
    }
    return <></>;
}
