It’s a declarative UI building powerhouse. It separates concerns in a way that makes a component do one thing, and it does it amazingly. Currently, we write functions, those functions get called by other functions and they display some stuff on the screen. Pretty simple, as it should 💅. I could go on for days why I love this library, but I won’t since you guys want to make a better Modal.

Prerequisites — Story and Styling

Image for post

aka the boring stuff

The modal has a wrapper that has a body. That body has a title, exit button and content. Just copy and paste the style, but I encourage you to write your own. Most of the styling came from the user story.

The wrapper is fixed, since we always want it at the front of the view. When the user clicks a button, the modal opens in view, providing the content in context, e.g. read more button. If the user clicks outside of the body or on the exit button, the modal closes. There should be an entry/exit animation and the modal content stays in view for the whole duration of the animation. When the modal is in view, the user can’t scroll the page.

Image for post

the .scss file

#programming #javascript #react #react-spring #web-development

Architecting and Making a Modal with React
1.15 GEEK