Skip to main content

max / makenotwork

1.1 KB · 35 lines History Blame Raw
1 {# Shared UI macros for parameterized primitives.
2 Use `{% include %}` for context-sharing partials (site_header, admin_nav).
3 Use these macros for parameterized shapes (empty state, etc).
4
5 Convention: import once at the top of a template as `ui`:
6 {%- import "partials/_ui.html" as ui -%}
7 then call:
8 {% call ui::empty_state("No items yet", "Create one to get started.") %}
9 #}
10
11 {% macro empty_state(title, body) -%}
12 <div class="empty-state">
13 {% if !title.is_empty() %}<h3>{{ title }}</h3>{% endif %}
14 <p>{{ body }}</p>
15 </div>
16 {%- endmacro %}
17
18 {% macro empty_state_with_action(title, body, action_href, action_label) -%}
19 <div class="empty-state">
20 {% if !title.is_empty() %}<h3>{{ title }}</h3>{% endif %}
21 <p>{{ body }}</p>
22 <p><a href="{{ action_href }}" class="btn-primary">{{ action_label }}</a></p>
23 </div>
24 {%- endmacro %}
25
26 {% macro empty_state_compact(body) -%}
27 <div class="empty-state empty-state--compact">
28 <p>{{ body }}</p>
29 </div>
30 {%- endmacro %}
31
32 {% macro empty_state_chart(body) -%}
33 <div class="empty-state empty-state--chart">{{ body }}</div>
34 {%- endmacro %}
35