I've introduced lightweight Modal component, that doesn't require any 3rd. party dependency except styled-components
<Modal
isActive={isActive}
portalContainerId="modal"
onClose={() => shouldChangeIsActiveToFalse()}
modalTitle="Title"
>
{content}
</Modal>
isActive
: [boolean] - tells modal if is active or notportalContainerId
: [string] - has to exist onindex.html
page, for example<div id="modal"></div>
- It will create react portal on this DOM elementonClose
: [function] - callback that should changeisActive
flagmodalTitle
: [string] - title of modal
unmountOnClose
: [boolean = false] - when true, will unmount modal on close, but CSS3 Transition will stop work (due to removal whole element from DOM)closeOnBackdropClick
: [boolean = false] - when true, click on a backdrop will triggeronClose
callback
- I didn't create controlled components - depends on your state implementation (redux, redux-form, etc)