-
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.
refactor(forms): create ConfirmationModal from Publish & Delete btns
- Loading branch information
Showing
7 changed files
with
140 additions
and
105 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
.../assets/semantic-ui/js/oarepo_ui/forms/components/ConfirmationModal/ConfirmationModal.jsx
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,38 @@ | ||
import React from "react"; | ||
import { Modal, Icon, Message } from "semantic-ui-react"; | ||
|
||
export function ConfirmationModal({ | ||
header, | ||
content, | ||
trigger, | ||
actions, | ||
isOpen, | ||
close, | ||
}) { | ||
return ( | ||
<> | ||
{trigger} | ||
<Modal | ||
open={isOpen} | ||
onClose={close} | ||
size="small" | ||
closeIcon | ||
closeOnDimmerClick={false} | ||
> | ||
<Modal.Header>{header}</Modal.Header> | ||
{content && ( | ||
<Modal.Content> | ||
<Message visible warning> | ||
<p> | ||
<Icon name="warning sign" /> {content} | ||
</p> | ||
</Message> | ||
</Modal.Content> | ||
)} | ||
<Modal.Actions>{actions}</Modal.Actions> | ||
</Modal> | ||
</> | ||
); | ||
} | ||
|
||
export default ConfirmationModal; |
2 changes: 2 additions & 0 deletions
2
oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/ConfirmationModal/index.js
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,2 @@ | ||
export * from './ConfirmationModal'; | ||
export { default } from './ConfirmationModal'; |
102 changes: 49 additions & 53 deletions
102
...o_ui/theme/assets/semantic-ui/js/oarepo_ui/forms/components/DeleteButton/DeleteButton.jsx
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
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