📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Added new line checks; made cancel button optional
Blaumaus4998a4bf2e50
diff --git a/src/components/Modal/index.jsx b/src/components/Modal/index.jsxindex f1225597c..b7db4e48e 100644--- a/src/components/Modal/index.jsx+++ b/src/components/Modal/index.jsx@@ -2,16 +2,24 @@ import React from 'react'import BM from 'react-bootstrap/Modal'import Button from 'react-bootstrap/Button'-const Modal = ({ title, text, onSubmit, onCancel, cancelText = 'Close', submitText = 'Save changes' }) => (+const NewLineText = ({ text }) => {+ return text.split('\n').map(str => <p key={str}>{str}</p>)+}++const Modal = ({ title, text, onSubmit = () => {}, onCancel, cancelText = 'Close', submitText = 'Save changes' }) => (<BM show={true} onHide={onCancel}><BM.Header closeButton><BM.Title>{title}</BM.Title></BM.Header>- <BM.Body>{text}</BM.Body>+ <BM.Body>+ <NewLineText text={text} />+ </BM.Body><BM.Footer>- <Button variant="secondary" onClick={onCancel}>- {cancelText}- </Button>+ {onCancel && (+ <Button variant="secondary" onClick={onCancel}>+ {cancelText}+ </Button>+ )}<Button variant="primary" onClick={onSubmit}>{submitText}</Button>