{# macros/navigation.html - Navigation component macros for APEP. Import with: {% from "apep/macros/navigation.html" import header_banner, nav, footer_nav, lang_switch, breadcrumb, pagination %} Macros: header_banner(company_name, subtitle, url, type, align) nav(items, variant, flying, top_offset) footer_nav(links, variant) lang_switch(current_lang, langs) breadcrumb(items, separator) pagination(current, total, url_pattern, delta) CSS dependency: nav.css, footer-nav.css, lang-switch.css, breadcrumb.css (loaded via ApepLoader) Author: sora7672 #} {% from "apep/macros/helper.html" import alert %} {# Renders a site header banner with a company name and optional subtitle. When url is provided the entire banner becomes a clickable anchor. Two visual types are available: "stacked" (default) - Surface background, company name + optional subtitle stacked vertically, primary-colored rule line below. Supports align: "left" | "center" (default) | "right" "side" - Surface background, primary-colored accent bar beside the name + subtitle. Bar switches side with alignment. Supports align: "left" (default) | "right" @param company_name {string} - company or site name displayed as the main text @param subtitle {string} - small muted text below/beside the name. Optional. @param url {string} - when set, wraps the banner in an tag. Optional. @param type {string} - visual type: "stacked" (default) or "side" @param align {string} - alignment of content within the banner. "stacked": "left" | "center" (default) | "right" "side": "left" (default) | "right" #} {% macro header_banner(company_name, subtitle=None, url=None, type="stacked", align=None) %} {% if not company_name %} {{ alert("header_banner: company_name is required", "Pass a non-empty string as the first argument.") }} {% elif type not in ["stacked", "side"] %} {{ alert("header_banner: invalid type \"" ~ type ~ "\"", "Allowed values: \"stacked\" (default), \"side\".") }} {% elif type == "side" and align is not none and align not in ["left", "right"] %} {{ alert("header_banner: invalid align \"" ~ align ~ "\" for type side", "Allowed values for side: \"left\" (default), \"right\".") }} {% elif type == "stacked" and align is not none and align not in ["left", "center", "right"] %} {{ alert("header_banner: invalid align \"" ~ align ~ "\" for type stacked", "Allowed values for stacked: \"left\", \"center\" (default), \"right\".") }} {% else %} {# Resolve effective alignment defaults per type #} {% if type == "side" %} {% set _align = align if align else "left" %} {% else %} {% set _align = align if align else "center" %} {% endif %} {# Shared outer tag - either or
#} {% if url %} {# side: accent bar left or right of text block #} {% if type == "side" %} {% if _align == "right" %}
{{ company_name }} {% if subtitle %} {{ subtitle }} {% endif %}
{% else %}
{{ company_name }} {% if subtitle %} {{ subtitle }} {% endif %}
{% endif %} {# stacked: name + optional subtitle + rule, container sized to text width #} {% else %}
{{ company_name }} {% if subtitle %} {{ subtitle }} {% endif %}
{% endif %} {% if url %}
{% else %}
{% endif %} {% endif %} {% endmacro %} {# Renders a responsive navigation bar with hamburger menu for mobile. Supports one level of dropdown children per item. Class structure on the rendered