-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added confirmation-modal to all leave-call-buttons
- Loading branch information
Showing
8 changed files
with
174 additions
and
43 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
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,5 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
export const ModalConfirmationText = styled.p` | ||
padding-bottom: 1rem; | ||
`; |
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,52 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
const ModalWrapper = styled.div` | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 1000; | ||
`; | ||
|
||
const ModalContent = styled.div` | ||
position: relative; | ||
background-color: #121212; | ||
padding: 2rem; | ||
border-radius: 0.8rem; | ||
box-shadow: 0 0.2rem 2rem rgba(123, 123, 123, 0.1); | ||
width: 40rem; | ||
max-width: 90%; | ||
animation: slideIn 0.3s ease-out; | ||
`; | ||
|
||
const CloseButton = styled.button` | ||
position: absolute; | ||
top: 1rem; | ||
right: 1rem; | ||
background: none; | ||
border: none; | ||
font-size: 2rem; | ||
cursor: pointer; | ||
color: gray; | ||
`; | ||
|
||
interface ModalProps { | ||
onClose: () => void; | ||
children: React.ReactNode; | ||
} | ||
|
||
export const Modal = ({ onClose, children }: ModalProps) => { | ||
return ( | ||
<ModalWrapper> | ||
<ModalContent> | ||
<CloseButton onClick={onClose}>×</CloseButton> | ||
{children} | ||
</ModalContent> | ||
</ModalWrapper> | ||
); | ||
}; |
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
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,42 @@ | ||
import styled from "@emotion/styled"; | ||
import { PrimaryButton } from "../landing-page/form-elements"; | ||
import { Spinner } from "../loader/loader"; | ||
|
||
type TVerifyDecision = { | ||
loader?: boolean; | ||
confirm: () => void; | ||
abort: () => void; | ||
}; | ||
|
||
const VerifyButtons = styled.div` | ||
display: flex; | ||
padding: 1rem 0 0 0; | ||
`; | ||
|
||
const Button = styled(PrimaryButton)` | ||
margin: 0 1rem 0 0; | ||
`; | ||
|
||
export const VerifyDecision = ({ loader, confirm, abort }: TVerifyDecision) => { | ||
return ( | ||
<VerifyButtons> | ||
<Button | ||
type="button" | ||
className={loader ? "submit" : ""} | ||
disabled={loader} | ||
onClick={() => confirm()} | ||
> | ||
Yes | ||
{loader && <Spinner className="manage-production" />} | ||
</Button> | ||
<Button | ||
type="button" | ||
className={loader ? "submit" : ""} | ||
onClick={() => abort()} | ||
> | ||
Go back | ||
{loader && <Spinner className="manage-production" />} | ||
</Button> | ||
</VerifyButtons> | ||
); | ||
}; |