-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
272 additions
and
69 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
35 changes: 29 additions & 6 deletions
35
src/app/components/Dashboard/User/DeleteUser/DeleteUser.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 |
---|---|---|
@@ -1,29 +1,52 @@ | ||
import React from 'react'; | ||
import Button from 'react-bootstrap/Button'; | ||
import Modal from 'react-bootstrap/Modal'; | ||
|
||
export const Header = ({ user }) => { | ||
const Header = ({ user }) => { | ||
const { id, name } = user; | ||
return <h1>Delete {name}</h1>; | ||
return ( | ||
<Modal.Header closeButton> | ||
<h1>Delete {name}</h1> | ||
</Modal.Header> | ||
); | ||
}; | ||
|
||
export const Body = ({ user }) => { | ||
return <p>Are you sure you want to delete {user.name}?</p>; | ||
const Body = ({ user }) => { | ||
return ( | ||
<Modal.Body> | ||
<p>Are you sure you want to delete {user.name}?</p> | ||
</Modal.Body> | ||
); | ||
}; | ||
|
||
export const Footer = ({ | ||
const Footer = ({ | ||
user, | ||
onCancel = () => console.log('Cancel delete'), | ||
onSuccess = (user) => console.log(`Delete user ${user.id}`), | ||
}) => { | ||
const { id } = user; | ||
return ( | ||
<> | ||
<Modal.Footer> | ||
<Button variant='secondary' onClick={onCancel}> | ||
Cancel | ||
</Button> | ||
<Button variant='danger' onClick={() => onSuccess(user)}> | ||
Delete | ||
</Button> | ||
</Modal.Footer> | ||
); | ||
}; | ||
|
||
export const DeleteUser = ({ | ||
user, | ||
onCancel = () => console.log('Cancel delete'), | ||
onSuccess = (user) => console.log(`Delete user ${user.id}`), | ||
}) => { | ||
return ( | ||
<> | ||
<Header user={user} /> | ||
<Body user={user} /> | ||
<Footer user={user} onCancel={onCancel} onSuccess={onSuccess} /> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.