refactor: split shop_components.ex into 5 focused sub-modules

4,487-line monolith → 23-line facade + 5 modules:
- Base (inputs, buttons, cards)
- Layout (header, footer, mobile nav, shop_layout)
- Cart (drawer, items, order summary)
- Product (cards, gallery, variant selector, hero)
- Content (rich text, images, contact, reviews)

`use SimpleshopThemeWeb.ShopComponents` imports all sub-modules.
No single file over ~1,600 lines now.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-08 14:30:25 +00:00
parent cb4698bec8
commit 3eacd91fda
11 changed files with 4537 additions and 4488 deletions

View File

@@ -78,7 +78,7 @@ defmodule SimpleshopThemeWeb.ShopLive.Collection do
@impl true
def render(assigns) do
~H"""
<SimpleshopThemeWeb.ShopComponents.shop_layout
<.shop_layout
theme_settings={@theme_settings}
logo_image={@logo_image}
header_image={@header_image}
@@ -91,7 +91,7 @@ defmodule SimpleshopThemeWeb.ShopLive.Collection do
active_page="collection"
>
<main id="main-content">
<SimpleshopThemeWeb.ShopComponents.collection_header
<.collection_header
title={@collection_title}
product_count={length(@products)}
/>
@@ -104,9 +104,9 @@ defmodule SimpleshopThemeWeb.ShopLive.Collection do
current_sort={@current_sort}
/>
<SimpleshopThemeWeb.ShopComponents.product_grid theme_settings={@theme_settings}>
<.product_grid theme_settings={@theme_settings}>
<%= for product <- @products do %>
<SimpleshopThemeWeb.ShopComponents.product_card
<.product_card
product={product}
theme_settings={@theme_settings}
mode={@mode}
@@ -114,7 +114,7 @@ defmodule SimpleshopThemeWeb.ShopLive.Collection do
show_category={@current_category == nil}
/>
<% end %>
</SimpleshopThemeWeb.ShopComponents.product_grid>
</.product_grid>
<%= if @products == [] do %>
<div class="text-center py-16" style="color: var(--t-text-secondary);">
@@ -130,7 +130,7 @@ defmodule SimpleshopThemeWeb.ShopLive.Collection do
<% end %>
</div>
</main>
</SimpleshopThemeWeb.ShopComponents.shop_layout>
</.shop_layout>
"""
end