This commit is contained in:
parent
824f038084
commit
3efb87bcd8
24 changed files with 14 additions and 19 deletions
24
app/message-banner.tsx
Normal file
24
app/message-banner.tsx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import {Action, actionClosedMessageBanner} from "./state/action.ts";
|
||||
import styles from "./message-banner.module.css";
|
||||
import {State} from "./state/state.ts";
|
||||
import {ActionDispatch} from "react";
|
||||
|
||||
export default function MessageBanner({state, dispatch}:
|
||||
{
|
||||
state: State;
|
||||
dispatch: ActionDispatch<[Action]>
|
||||
}) {
|
||||
function handleClose() {
|
||||
dispatch(actionClosedMessageBanner());
|
||||
}
|
||||
|
||||
if (!!state.errorMessage) {
|
||||
return (
|
||||
<div className={styles.banner + " " + styles.message}>
|
||||
{state.errorMessage}
|
||||
<button onClick={handleClose}>Dismiss message</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (<div className={styles.banner + " " + styles.empty}></div>);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue