{#- Macros the layout and a site's own components share. -#} {%- macro components(names) -%} {%- for name in names %}{% include ["components/" ~ name, name] ignore missing %}{% endfor -%} {%- endmacro %} {#- A ghost icon button, or a link when href is given. The named icon fills it unless the caller supplies its own content with call. tooltip_class adds a placement class such as tooltip-bottom, written in full by the caller so Tailwind finds it. -#} {%- macro icon_button(label, icon, tooltip="", data={}, href="", tooltip_class="") -%} {%- set tag = "a" if href else "button" -%} <{{ tag }}{% if href %} href="{{ href|e }}"{% else %} type="button"{% endif %} class="btn btn-ghost btn-sm btn-square{% if tooltip %} tooltip{% if tooltip_class %} {{ tooltip_class|e }}{% endif %}{% endif %}"{% if tooltip %} data-tip="{{ tooltip|e }}"{% endif %} aria-label="{{ label|e }}"{% for name, value in data.items() %} data-{{ name|e }}="{{ value|e }}"{% endfor %}>{% if caller is defined %}{{ caller() }}{% else %}{{ daisy.icon(icon) }}{% endif %}{{ tag }}> {%- endmacro %} {#- A ghost link with an icon and its text, for the sidebar. rel is added when given. -#} {%- macro source_link(href, icon, label, rel="") -%} {{ daisy.icon(icon, 'size-4') }}{{ label|e }} {%- endmacro %} {#- One dropdown in the navbar. The caller fills the trigger and the panel: {% call(part) navbar_dropdown() %}{% if part == "trigger" %}...{% else %}...{% endif %}{% endcall %} tag and panel_tag are the outer and panel elements, trigger_class and panel_class add classes to the trigger and the panel, attrs adds attributes to the outer element and trigger_attrs to the trigger. Values are escaped here. -#} {%- macro navbar_dropdown(tag="div", panel_tag="div", trigger_class="", panel_class="", label="", attrs={}, trigger_attrs={}) -%} <{{ tag }} class="daisy-dropdown dropdown dropdown-end"{% for name, value in attrs.items() %} {{ name|e }}="{{ value|e }}"{% endfor %}>