simplify footer categories: fetch directly instead of threading assigns
shop_footer now calls PreviewData.categories() itself, removing the need to thread categories through CartHook, shop_layout, and all 8 page templates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -65,7 +65,6 @@ defmodule SimpleshopThemeWeb.ShopComponents.Layout do
|
||||
attr :cart_subtotal, :string, required: true
|
||||
attr :cart_drawer_open, :boolean, default: false
|
||||
attr :cart_status, :string, default: nil
|
||||
attr :categories, :list, default: []
|
||||
attr :active_page, :string, required: true
|
||||
attr :error_page, :boolean, default: false
|
||||
|
||||
@@ -96,7 +95,7 @@ defmodule SimpleshopThemeWeb.ShopComponents.Layout do
|
||||
|
||||
{render_slot(@inner_block)}
|
||||
|
||||
<.shop_footer theme_settings={@theme_settings} mode={@mode} categories={@categories} />
|
||||
<.shop_footer theme_settings={@theme_settings} mode={@mode} />
|
||||
|
||||
<.cart_drawer
|
||||
cart_items={@cart_items}
|
||||
@@ -406,10 +405,12 @@ defmodule SimpleshopThemeWeb.ShopComponents.Layout do
|
||||
"""
|
||||
attr :theme_settings, :map, required: true
|
||||
attr :mode, :atom, default: :live
|
||||
attr :categories, :list, default: []
|
||||
|
||||
def shop_footer(assigns) do
|
||||
assigns = assign(assigns, :current_year, Date.utc_today().year)
|
||||
assigns =
|
||||
assigns
|
||||
|> assign(:current_year, Date.utc_today().year)
|
||||
|> assign(:categories, SimpleshopTheme.Theme.PreviewData.categories())
|
||||
|
||||
~H"""
|
||||
<footer style="background-color: var(--t-surface-raised); border-top: 1px solid var(--t-border-default);">
|
||||
|
||||
Reference in New Issue
Block a user