From e2d089e9867d243e58bff7ddf65c6a77409a667a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Thu, 31 Jan 2019 10:50:15 +0100 Subject: [PATCH 01/13] change classes to bulma classes --- .../ui-components/src/modals/ConfirmAlert.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js b/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js index 1f93024865..37cd849047 100644 --- a/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js +++ b/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js @@ -32,11 +32,15 @@ class ConfirmAlert extends React.Component { const { title, message, buttons } = this.props; return ( -
-
- { -
- {title &&

{title}

} +
+
+ +
+

+ {title} +

+
+
{message}
{buttons.map((button, i) => ( @@ -49,8 +53,8 @@ class ConfirmAlert extends React.Component { ))}
-
- } + +
); From 7a6d5e4cc4034453a73d9b4b21c2b0e14f5d8fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Thu, 31 Jan 2019 11:01:37 +0100 Subject: [PATCH 02/13] set background --- .../packages/ui-components/src/modals/ConfirmAlert.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js b/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js index 37cd849047..e7501a39a6 100644 --- a/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js +++ b/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js @@ -33,6 +33,7 @@ class ConfirmAlert extends React.Component { return (
+
From 1f6801978071744e95f136531dc05a43abdf52c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Thu, 31 Jan 2019 11:07:54 +0100 Subject: [PATCH 03/13] add close button --- .../packages/ui-components/src/modals/ConfirmAlert.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js b/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js index e7501a39a6..ad296cee6b 100644 --- a/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js +++ b/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js @@ -40,6 +40,11 @@ class ConfirmAlert extends React.Component {

{title}

+
{message} From 9e9b3b14d7a6a3291bc65ef4c721e26da41cff66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Fri, 1 Feb 2019 08:47:38 +0100 Subject: [PATCH 04/13] add extra root for modals and use it --- .../ui-components/src/modals/ConfirmAlert.js | 30 ++++--------------- scm-ui/public/index.mustache | 2 ++ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js b/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js index ad296cee6b..416853cffa 100644 --- a/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js +++ b/scm-ui-components/packages/ui-components/src/modals/ConfirmAlert.js @@ -1,8 +1,6 @@ // @flow -//modified from https://github.com/GA-MO/react-confirm-alert - import * as React from "react"; -import { render, unmountComponentAtNode } from "react-dom"; +import ReactDOM from "react-dom"; import "./ConfirmAlert.css"; type Button = { @@ -25,7 +23,7 @@ class ConfirmAlert extends React.Component { }; close = () => { - removeElementReconfirm(); + ReactDOM.unmountComponentAtNode(document.getElementById("modalRoot")); }; render() { @@ -67,27 +65,11 @@ class ConfirmAlert extends React.Component { } } -function createElementReconfirm(properties: Props) { - const divTarget = document.createElement("div"); - divTarget.id = "react-confirm-alert"; - if (document.body) { - document.body.appendChild(divTarget); - render(, divTarget); - } -} - -function removeElementReconfirm() { - const target = document.getElementById("react-confirm-alert"); - if (target) { - unmountComponentAtNode(target); - if (target.parentNode) { - target.parentNode.removeChild(target); - } - } -} - export function confirmAlert(properties: Props) { - createElementReconfirm(properties); + const root = document.getElementById("modalRoot"); + if(root){ + ReactDOM.render(, root); + } } export default ConfirmAlert; diff --git a/scm-ui/public/index.mustache b/scm-ui/public/index.mustache index 590b5e3cdb..75efc78088 100644 --- a/scm-ui/public/index.mustache +++ b/scm-ui/public/index.mustache @@ -21,6 +21,8 @@ You need to enable JavaScript to run this app.
+
+