-
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.
refactor: Adapt confirm dialig for save and delete case.
- Loading branch information
1 parent
380a0e8
commit 56c979a
Showing
3 changed files
with
27 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Dialog } from '@equinor/eds-core-react'; | ||
import styled from 'styled-components'; | ||
import { spacings } from '../../tokens/spacings'; | ||
|
||
export const Actions = styled(Dialog.Actions)` | ||
display: flex; | ||
flex: row; | ||
flex-direction: row; | ||
column-gap: ${spacings.SMALL}; | ||
align-items: start; | ||
`; |
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 |
---|---|---|
@@ -1,30 +1,36 @@ | ||
import { Button, Dialog, Typography } from '@equinor/eds-core-react'; | ||
import * as Styled from './ConfirmDialog.styled'; | ||
|
||
export const ConfirmDialog = ({ | ||
isOpen, | ||
message, | ||
danger, | ||
confirmAction, | ||
setIsOpen, | ||
}: { | ||
isOpen: boolean; | ||
message: string; | ||
danger: boolean; | ||
confirmAction: () => void; | ||
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>; | ||
}) => { | ||
return ( | ||
<Dialog open={isOpen}> | ||
<Dialog.Header> | ||
<Dialog.Title>Confirm</Dialog.Title> | ||
</Dialog.Header> | ||
<Dialog.CustomContent> | ||
<Typography variant="body_short">{message}</Typography> | ||
</Dialog.CustomContent> | ||
<Dialog.Actions> | ||
<Button onClick={confirmAction}>OK</Button> | ||
<Button variant="ghost" onClick={() => setIsOpen(false)}> | ||
Cancel | ||
<Styled.Actions> | ||
<Button | ||
variant="outlined" | ||
color={danger ? 'danger' : undefined} | ||
onClick={() => setIsOpen(false)} | ||
> | ||
{'Cancle'} | ||
</Button> | ||
</Dialog.Actions> | ||
<Button color={danger ? 'danger' : undefined} onClick={confirmAction}> | ||
{danger ? 'Delete' : 'Ok'} | ||
</Button> | ||
</Styled.Actions> | ||
</Dialog> | ||
); | ||
}; |
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