diff --git a/web/src/lib.rs b/web/src/lib.rs index 6e06841d..978cef6c 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -207,10 +207,20 @@ mod tests { body.contains("href=\"/static/app.css\""), "{path} is missing the shared stylesheet" ); - assert!( - !body.contains(" + + + {# + Penguin UI (https://www.penguinui.com) is Tailwind + Alpine, and its + components are what this app uses for anything the user has to be told: + ui/alert.html and ui/dialog.html. The focus plugin is what x-trap in the + dialog needs, and it has to load before Alpine itself. + #} + + + + + + {% block head %}{% endblock %}
diff --git a/web/templates/ui/dialog.html b/web/templates/ui/dialog.html new file mode 100644 index 00000000..c1c2cd51 --- /dev/null +++ b/web/templates/ui/dialog.html @@ -0,0 +1,54 @@ +{# + Blocking modal dialog — Penguin UI's "modal" component + (https://www.penguinui.com/components/modal, modern style), with the dark + variants dropped because the app has no dark theme. + + It is Tailwind + Alpine markup, so a page that calls this macro must load + both in its `head` block; `pages/add_table/add_table.html` shows the set. + The `@theme` block there maps Penguin UI's semantic colour names onto the + palette in `static/app.css`. + + Rendered already open (`modalIsOpen: true`): the server only sends the + dialog when there is something the user has to be told, so there is no + trigger button — the response itself is the trigger. + + {% import "ui/dialog.html" as dialog %} + {% call dialog::error("Could not add the column", message) %}{% endcall %} +#} +{% macro error(title, message) %} +{{ message }}
+