Add cart + auth fragment pre-fetching to blog context
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m1s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m1s
Phase 2 of fragment composition: blog_context() now concurrently fetches cart-mini and auth-menu HTML fragments from cart and account apps via fetch_fragments(). Updates shared submodule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
54
templates/_types/root/header/_header.html
Normal file
54
templates/_types/root/header/_header.html
Normal file
@@ -0,0 +1,54 @@
|
||||
{% set select_colours = "
|
||||
[.hover-capable_&]:hover:bg-yellow-300
|
||||
aria-selected:bg-stone-500 aria-selected:text-white
|
||||
[.hover-capable_&[aria-selected=true]:hover]:bg-orange-500
|
||||
"%}
|
||||
{% import 'macros/links.html' as links %}
|
||||
|
||||
{% macro header_row(oob=False) %}
|
||||
{% call links.menu_row(id='root-row', oob=oob) %}
|
||||
<div class="w-full flex flex-row items-top">
|
||||
{# Cart mini — fetched from cart app as fragment #}
|
||||
{% if cart_mini_html %}
|
||||
{{ cart_mini_html | safe }}
|
||||
{% else %}
|
||||
{% from '_types/cart/_mini.html' import mini with context %}
|
||||
{{mini()}}
|
||||
{% endif %}
|
||||
|
||||
{# Site title #}
|
||||
<div class="font-bold text-5xl flex-1">
|
||||
{% from 'macros/title.html' import title with context %}
|
||||
{{ title('flex justify-center md:justify-start')}}
|
||||
</div>
|
||||
|
||||
{# Desktop nav #}
|
||||
<nav class="hidden md:flex gap-4 text-sm ml-2 justify-end items-center flex-0">
|
||||
{% include '_types/root/_nav.html' %}
|
||||
{# Auth menu — fetched from account app as fragment #}
|
||||
{% if auth_menu_html %}
|
||||
{{ auth_menu_html | safe }}
|
||||
{% else %}
|
||||
{% if not g.user %}
|
||||
{% include '_types/root/_sign_in.html' %}
|
||||
{% else %}
|
||||
{% include '_types/root/_full_user.html' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% include "_types/root/_nav_panel.html"%}
|
||||
</nav>
|
||||
{% include '_types/root/_hamburger.html' %}
|
||||
</div>
|
||||
{% endcall %}
|
||||
{# Mobile user info #}
|
||||
<div class="block md:hidden text-md font-bold">
|
||||
{# Auth menu mobile — part of auth-menu fragment (id=auth-menu-mobile) #}
|
||||
{% if not auth_menu_html %}
|
||||
{% if g.user %}
|
||||
{% include '_types/root/mobile/_full_user.html' %}
|
||||
{% else %}
|
||||
{% include '_types/root/mobile/_sign_in.html' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user