Add reusable modal #362
Reference in New Issue
Block a user
Delete Branch "add-modal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes https://github.com/maybe-finance/maybe/issues/360
This adds a
modalhelper method. This wraps the complexity of rendering a modal such that you just need to wrap your view with this helper:To trigger the display of the modal - any link or button that should open a modal needs to specify to use the modal turbo frame
<%= link_to "Open Modal", some_path, data: { turbo_frame: "modal" }The modal will close on ESC and clicking away from it. It includes a backdrop that is currently the browser default but can be styled further.
This PR doesn't add any styling/headers/footers to the actual modal. It simply provides the mechanism to open/close a modal using standard rails/hotwire.
It looks like this:
@Shpigford question on styling (re figma). Do we want it as close as possible to the Figma using Tailwind defaults, or do we want to style is exactly as per the Figma file (I don't mind either way but there are some colors, shadows that are not default TW, so will need to slap the config around a bit.
Ideally exactly, including creating new colors and shadows in Tailwind config.
Great job on this!
@robzolkos Learned a couple of things from this PR, so thank you!