question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modal reusability

See original GitHub issue

Given a list of item, each have a part defined as

<a href="#itemModal" data-id={ item._id ">{ item.name }</a>

and the modal is manually defined as

<div id="itemModal" className="modal modal-fixed-footer">
  <div className="modal-content">
    <h4>Edit Model</h4>
    <form> ... </form>
  </div>
  <div className="modal-footer">
    <a href="#!" className="modal-action modal-close waves-effect waves-green btn-flat ">Close</a>
  </div>
</div>

At the moment, the Modal component seem to require a trigger prop.

How can this component be reusable? I don’t want to create 500 if I have 500 items in my list.

Edit

A suggestion could be to have trigger be optional, and allow a selector prop to use when initializing the overlay with Materialize’s leanModal.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
isaiahcommented, Nov 28, 2016

@yanickrochon So the only requirement is to make the trigger property optional, right? We can make it happen.

1reaction
yanickrochoncommented, Sep 13, 2016

Bump.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building a Reusable Modal Component with Dynamic Content ...
I recently came across the use case for a modal in one of my personal projects — the usual 'are you sure you...
Read more >
Create Reusable MODALS in REACT JS | by Shmoji - codeburst
Hello, Shmoji here. Today we are going to be creating reusable modals using React. In case you didn't know, the GIF above is...
Read more >
Developing Reusable and Customizable Modals With React ...
Create reusable and customizable modals with React and TypeScript. Learn how to make a complete modal with React Portals and styled-components.
Read more >
Reusable Modal Component - CodePen
URL Extension Required. When linking another Pen as a resource, make sure you use a URL Extension of the type of code you...
Read more >
Create a reusable modal with LiveView Component
In LiveView that is called a LiveComponent. In this tutorial I will go through how to set up reusable modal in Phoenix LiveView...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found