-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Replace browser confirm dialog with lightbox dialog [PT-188245120]
This should prevent fullscreen mode from exiting due to the system confirm dialog showing.
- Loading branch information
1 parent
5b6061c
commit 905f341
Showing
3 changed files
with
108 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.confirmModalBackground { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
background: #000; | ||
opacity: 0.25; | ||
z-index: 100; | ||
} | ||
.confirmModal { | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 101; | ||
user-select: none; | ||
|
||
.confirmModalContent { | ||
min-width: 200px; | ||
|
||
.confirmModalTitle { | ||
background-color: #177991; | ||
color: white; | ||
padding: 5px 10px; | ||
} | ||
|
||
.confirmModalInnerContent { | ||
padding: 10px; | ||
background-color: white; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
|
||
.confirmModalButtons { | ||
display: flex; | ||
gap: 5px; | ||
justify-content: flex-end; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { ReactNode } from "react"; | ||
|
||
import "./confirm-modal.scss"; | ||
|
||
export interface IConfirmModal { | ||
title: string; | ||
message: string|ReactNode; | ||
onOk: () => void, | ||
onClose: () => void | ||
} | ||
|
||
export const ConfirmModal = ({ title, message, onOk, onClose }: IConfirmModal) => { | ||
const handleOk = () => { | ||
onOk(); | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className="confirmModalBackground" /> | ||
<div className="confirmModal"> | ||
<div className="confirmModalContent"> | ||
<div className="confirmModalTitle">{title}</div> | ||
<div className="confirmModalInnerContent"> | ||
{message} | ||
<div className="confirmModalButtons"> | ||
<button onClick={handleOk}>Ok</button> | ||
<button onClick={onClose}>Cancel</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; |