Comment

Comment by rrr_oh_man

Is that really easier than using templates?

> Wrapping Bootstrap Modal could be achieved with a function like this:

  def bootstrap_modal(*, title: str, body: Node = None, footer: Node = None) -> 
  Element:
      return div(".modal", tabindex="-1", role="dialog")[
          div(".modal-dialog", role="document")[
              div(".modal-content")[
                  div(".modal-header")[
                      div(".modal-title")[
                          h5(".modal-title")[title],
                          button(
                              ".close",
                              type="button",
                              data_dismiss="modal",
                              aria_label="Close",
                          )[span(aria_hidden="true")[Markup("×")]],
                      ]
                  ],
                  div(".modal-body")[body],
                  footer and div(".modal-footer")[footer],
              ]
          ]
      ]
parent rrr_oh_man 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton