Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add utility class for creating and attaching modals in the DOM #105

Open
2 tasks
fabiodrg opened this issue Mar 24, 2022 · 0 comments
Open
2 tasks

Add utility class for creating and attaching modals in the DOM #105

fabiodrg opened this issue Mar 24, 2022 · 0 comments
Labels
code quality Issues related to improve code quality

Comments

@fabiodrg
Copy link
Collaborator

Modals were only used for calendar events, but now are used for 'batch email' (#101) and also for grades simulation (#64). The idea is to create an util class that creates the modal skeletons and attaches them in DOM. The skeleton only manages how to open the modal, where to insert it in the DOM and how to close the modal. The skeleton could provide an interface to specify a title, the body and an eventual footer. Using this skeleton modal ensures consistency and avoids duplicated code.

class Modal {
  static id; // to assign unique identifiers and allow multiple modals in the same page context ?
  // title is a string. body and footer are HTMLElements. isPermanent indicates whether the modal should be removed after opening/closing once (all existing modals are like this, although I think it was just because it was easier to avoid clashes between multiple modals)
  constructor(title, body, footer, isPermanent) {}
  // this triggers the modal to open and can be used externally to attach to event listeners and yada yada
  open() {}
}
  • Ability to specify the title, body content and footer content
  • Possibility for modals being permanent in the DOM and support co-existing modals
@fabiodrg fabiodrg added the code quality Issues related to improve code quality label Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Issues related to improve code quality
Projects
None yet
Development

No branches or pull requests

1 participant