diff --git a/packages/ui/src/components/Molecules/Messages.tsx b/packages/ui/src/components/Molecules/Messages.tsx index 93fce8e63..32b8236fb 100644 --- a/packages/ui/src/components/Molecules/Messages.tsx +++ b/packages/ui/src/components/Molecules/Messages.tsx @@ -19,19 +19,32 @@ export function Messages(props: { setDisplayMessages(props.messages); }, [props.messages]); + const handleRemoveMessage = (index: number) => { + const newMessages = displayMessages.filter((_, i) => i !== index); + setDisplayMessages(newMessages); + storeMessages(newMessages); + }; + return (
- {buildMessages(displayMessages, setDisplayMessages)} - {props.messageComponents} + {buildMessages(displayMessages, handleRemoveMessage)} + {/* {buildMessages(displayMessages, setDisplayMessages)} */}
); } +// export const buildMessages = (messages: Array) => ( +// <> +// {messages.map((message, index) => ( +// +// ))} +// +// ); export const buildMessages = ( messages: Array, - setDisplayMessages: React.Dispatch>, + handleRemoveMessage?: (index: number) => void, ) => { return messages.map((message, index) => (
- + Close + + + )} )); };