Page MenuHomePhabricator

[web] Convert `Modal` into functional component
ClosedPublic

Authored by jacek on Apr 8 2022, 4:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 18, 8:25 AM
Unknown Object (File)
Sat, Mar 1, 4:38 AM
Unknown Object (File)
Wed, Feb 26, 1:06 AM
Unknown Object (File)
Feb 16 2025, 2:25 PM
Unknown Object (File)
Feb 7 2025, 6:50 PM
Unknown Object (File)
Feb 5 2025, 10:04 AM
Unknown Object (File)
Feb 3 2025, 10:47 AM
Unknown Object (File)
Feb 3 2025, 10:47 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Looks good!

web/modals/modal.react.js
18 ↗(On Diff #11224)

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

32 ↗(On Diff #11224)

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 ↗(On Diff #11224)

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.