generated from goitacademy/react-homework-template
-
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.
Merge pull request #69 from Yura-Platonov/createAdv
Create adv
- Loading branch information
Showing
10 changed files
with
502 additions
and
170 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,61 @@ | ||
import { useDispatch } from 'react-redux'; | ||
import { ConfDiv } from './confirmModal.styled'; | ||
import { setIsOpen } from 'redux/modal/modalSlice'; | ||
import { XBTN } from './confirmModalSVG'; | ||
|
||
const СonfirmModalAdvertisement = ({ handleSearch1 }) => { | ||
const dispatch = useDispatch(); | ||
|
||
const closeModal = () => { | ||
dispatch(setIsOpen(false)); | ||
}; | ||
|
||
const confirmModalAdvertisement = () => { | ||
handleSearch1({ | ||
'advertisementDTO.carDTO.carMark.name': '', | ||
'advertisementDTO.carDTO.carMark.carModel.name': '', | ||
'advertisementDTO.carDTO.carNumber': '', | ||
'advertisementDTO.region.name': '', | ||
'advertisementDTO.region.city.name': '', | ||
'advertisementDTO.carDTO.mileage': '', | ||
'advertisementDTO.carDTO.yearToCreate': '', | ||
'advertisementDTO.price': '', | ||
'advertisementDTO.carDTO.bodyType.name': '', | ||
'advertisementDTO.carDTO.engine.name': '', | ||
'advertisementDTO.carDTO.engine.volume': '', | ||
'advertisementDTO.carDTO.driveType.name': '', | ||
'advertisementDTO.carDTO.transmission.name': '', | ||
'advertisementDTO.carDTO.technicalState.name': '', | ||
'advertisementDTO.carDTO.color.name': '', | ||
'advertisementDTO.carDTO.vinNumber': '', | ||
'advertisementDTO.description': '', | ||
'advertisementDTO.ownerName': '', | ||
'advertisementDTO.ownerPhone': '', | ||
}); | ||
dispatch(setIsOpen(false)); | ||
}; | ||
|
||
return ( | ||
<ConfDiv> | ||
<button type="button" onClick={closeModal} className="xBtn"> | ||
<XBTN /> | ||
</button> | ||
<h4 className="title"> | ||
Ви впевнені що хочете <span className="cringe">очистити</span> фільтри? | ||
</h4> | ||
<p className="content"> | ||
Натискаючи на кнопку “підтвердити” форма заповнення <br/>оголошення повністю очиститься | ||
</p> | ||
<div className="buttonBox"> | ||
<button type="button" onClick={closeModal} className="cansel"> | ||
Відмінити | ||
</button> | ||
<button type="button" onClick={confirmModalAdvertisement} className="confirm"> | ||
Підтвердити | ||
</button> | ||
</div> | ||
</ConfDiv> | ||
); | ||
}; | ||
|
||
export default СonfirmModalAdvertisement; |
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,25 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
import { useSelector } from 'react-redux'; | ||
import { selectIsOpen } from 'redux/modal/modalSlice'; | ||
import ModalWraper from './modalWraper/modalWraper'; | ||
import ConfirmModalAdvertisement from './confirmModal/confirmModalAdvertisement'; | ||
|
||
|
||
const Modal = ({ handleSearch1 }) => { | ||
const isOpen = useSelector(selectIsOpen); | ||
|
||
return ReactDOM.createPortal( | ||
<> | ||
{isOpen && ( | ||
<ModalWraper> | ||
<ConfirmModalAdvertisement handleSearch1={handleSearch1} /> | ||
</ModalWraper> | ||
)} | ||
</>, | ||
document.getElementById('portal') | ||
); | ||
}; | ||
|
||
export default Modal; |
Oops, something went wrong.