Skip to content

Commit a482a92

Browse files
#168 - Align Modal to Center of PDF if Signed
1 parent 0a36550 commit a482a92

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

microfrontends/SignDocuments/package-lock.json

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

microfrontends/SignDocuments/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"react-scrollbars-custom": "^4.1.1",
3333
"react-signature-canvas": "^1.0.6",
3434
"reactour": "^1.19.1",
35+
"select-dom": "^9.0.0",
3536
"web-vitals": "^2.1.4"
3637
},
3738
"scripts": {

microfrontends/SignDocuments/src/Component/SignYourselfPdf.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import Nodata from "./component/Nodata";
2525
import Header from "./component/header";
2626
import RenderPdf from "./component/renderPdf";
2727
import { contractUsers, contactBook } from "../utils/Utils";
28+
import { $ } from 'select-dom';
2829
//For signYourself inProgress section signer can add sign and complete doc sign.
2930
function SignYourSelf() {
3031
const [pdfDetails, setPdfDetails] = useState([]);
@@ -995,6 +996,17 @@ function SignYourSelf() {
995996
});
996997
};
997998

999+
const modalAlign = () => {
1000+
let modalDialog = $('.modal-dialog').getBoundingClientRect();
1001+
let mobileHead = $('.mobileHead').getBoundingClientRect()
1002+
let modal = $('.modal-dialog');
1003+
if (modalDialog.left < mobileHead.left) {
1004+
let leftOffset = mobileHead.left - modalDialog.left;
1005+
modal.style.left = leftOffset + 'px';
1006+
modal.style.top = (window.innerHeight/2.5) + 'px';
1007+
}
1008+
};
1009+
9981010
return (
9991011
<DndProvider backend={HTML5Backend}>
10001012
{isLoading.isLoad ? (
@@ -1036,7 +1048,10 @@ function SignYourSelf() {
10361048
>
10371049
{/* this modal is used show this document is already sign */}
10381050

1039-
<Modal show={showAlreadySignDoc.status}>
1051+
<Modal
1052+
show={showAlreadySignDoc.status}
1053+
onShow={() => modalAlign()}
1054+
>
10401055
<ModalHeader style={{ background: themeColor() }}>
10411056
<span style={{ color: "white" }}> Sign Documents</span>
10421057
</ModalHeader>

microfrontends/SignDocuments/src/Component/recipientSignPdf.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import Nodata from "./component/Nodata";
2525
import Header from "./component/header";
2626
import RenderPdf from "./component/renderPdf";
2727
import CustomModal from "./component/CustomModal";
28+
import { $ } from 'select-dom';
2829
function EmbedPdfImage() {
2930
const { id, contactBookId } = useParams();
3031
const [isSignPad, setIsSignPad] = useState(false);
@@ -953,6 +954,17 @@ function EmbedPdfImage() {
953954
);
954955
};
955956

957+
const modalAlign = () => {
958+
let modalDialog = $('.modal-dialog').getBoundingClientRect();
959+
let mobileHead = $('.mobileHead').getBoundingClientRect()
960+
let modal = $('.modal-dialog');
961+
if (modalDialog.left < mobileHead.left) {
962+
let leftOffset = mobileHead.left - modalDialog.left;
963+
modal.style.left = leftOffset + 'px';
964+
modal.style.top = (window.innerHeight/2.5) + 'px';
965+
}
966+
};
967+
956968
return (
957969
<DndProvider backend={HTML5Backend}>
958970
{isLoading.isLoad ? (
@@ -1016,7 +1028,10 @@ function EmbedPdfImage() {
10161028
}}
10171029
>
10181030
{/* this modal is used show this document is already sign */}
1019-
<Modal show={isAlreadySign.status}>
1031+
<Modal
1032+
show={isAlreadySign.status}
1033+
onShow={() => modalAlign()}
1034+
>
10201035
<ModalHeader style={{ background: themeColor() }}>
10211036
<span style={{ color: "white" }}> Sign Documents</span>
10221037
</ModalHeader>

0 commit comments

Comments
 (0)