Page MenuHomePhabricator

[web] Convert `Modal` into functional component
ClosedPublic

Authored by jacek on Apr 8 2022, 4:24 AM.
Tags
None
Referenced Files
F3610836: D3667.id11465.diff
Wed, Jan 1, 12:34 AM
F3610652: D3667.id11877.diff
Wed, Jan 1, 12:18 AM
F3610218: D3667.id11922.diff
Tue, Dec 31, 11:09 PM
F3610078: D3667.id11933.diff
Tue, Dec 31, 10:50 PM
Unknown Object (File)
Sun, Dec 29, 3:23 AM
Unknown Object (File)
Sat, Dec 14, 7:18 AM
Unknown Object (File)
Fri, Dec 6, 4:49 PM
Unknown Object (File)
Tue, Dec 3, 4:45 AM

Details

Summary

Convert exiting Modal component from class into functional component to simplify the logic and make future changes easier. No logic changes has been made.

Test Plan

All existing modals should work as before

Diff Detail

Repository
rCOMM Comm
Branch
jacek/modal-3
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Looks good!

web/modals/modal.react.js
18

Setting the default when destructuring looks a lot cleaner than the old defaultProps approach.

32

Outside of the scope of this diff, but might be good to add a comment noting that keyCode 27 corresponds to the ESC key? I had a hunch, but still had to google to double check.

This revision is now accepted and ready to land.Apr 8 2022, 10:38 AM
web/modals/modal.react.js
32

Good idea. I was thinking about adding the comment (as I also had to use https://keycode.info/ to check), but I forgot about it.