From 14da0a41981c9223499d0c342f2fcabc761d5fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Sun, 30 Oct 2022 18:54:10 +0000 Subject: [PATCH] fix: modal HTML text --- examples/web/react/components/modal/modal.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/web/react/components/modal/modal.tsx b/examples/web/react/components/modal/modal.tsx index 1eac3e9a..0f632a0b 100644 --- a/examples/web/react/components/modal/modal.tsx +++ b/examples/web/react/components/modal/modal.tsx @@ -31,6 +31,9 @@ export const Modal: FC<ModalProps> = ({ } }); }, []); + const getTextHtml = (separator = /\n/g) => ({ + __html: text.replace(separator, "<br/>") + }); return ( <div className={classes()}> <div className="modal-window"> @@ -44,7 +47,10 @@ export const Modal: FC<ModalProps> = ({ /> </div> <h2 className="modal-title">{title}</h2> - <p className="modal-text">{text}</p> + <p + className="modal-text" + dangerouslySetInnerHTML={getTextHtml()} + ></p> <div className="modal-buttons"> <Button text={"Cancel"} -- GitLab