nice-modal-react icon indicating copy to clipboard operation
nice-modal-react copied to clipboard

Add ability to resolve/reject and hide

Open adrhumphreys opened this issue 2 years ago • 3 comments

Hey team,

Loving the library and I found that I often would call resolve and hide or reject and hide, and noticed that there was a similar pattern mentioned in #88

This would mean that users are able to do something like:

const {resolveAndHide} = useModal()

return (
  <Modal onClose={() => resolveAndHide(false)}>
   <p>Content</p>
  </Modal>
)

Happy to update with any feedback

Reason for creating new methods was to keep backwards compatibility

adrhumphreys avatar Jan 17 '23 22:01 adrhumphreys

Codecov Report

Merging #99 (70fa54b) into main (f146959) will decrease coverage by 2.88%. The diff coverage is 25.00%.

@@             Coverage Diff             @@
##              main      #99      +/-   ##
===========================================
- Coverage   100.00%   97.12%   -2.88%     
===========================================
  Files            1        1              
  Lines          201      209       +8     
  Branches        30       30              
===========================================
+ Hits           201      203       +2     
- Misses           0        6       +6     
Impacted Files Coverage Δ
src/index.tsx 97.12% <25.00%> (-2.88%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Jan 17 '23 22:01 codecov-commenter

Hi @adrhumphreys , thanks for the PR! It looks good to me. Could you please also add unit tests for the new APIs so that it would be merged?

supnate avatar Jan 21 '23 02:01 supnate

Hey @supnate sorry for the long delay, just added in some tests now if you want to have a review over them, thanks

adrhumphreys avatar Feb 06 '23 20:02 adrhumphreys