refactor admin CSS: replace utility classes with semantic styles

Replace Tailwind utility soup across admin templates with semantic
CSS classes. Add layout primitives (stack, row, cluster, grid),
extract JS transition helpers into transitions.css, and refactor
core_components, layouts, settings, newsletter, order_show, providers,
and theme editor templates.

Utility occurrences reduced from 290+ to 127 across admin files.
All 1679 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-03-01 17:15:25 +00:00
parent edef628214
commit b7ec41b0cf
13 changed files with 2661 additions and 1643 deletions

View File

@@ -51,17 +51,17 @@ defmodule BerrypodWeb.CoreComponents do
{@rest}
>
<div class={[
"admin-alert w-80 sm:w-96 max-w-80 sm:max-w-96 text-wrap",
"admin-alert",
@kind == :info && "admin-alert-info",
@kind == :error && "admin-alert-error"
]}>
<.icon :if={@kind == :info} name="hero-information-circle" class="size-5 shrink-0" />
<.icon :if={@kind == :error} name="hero-exclamation-circle" class="size-5 shrink-0" />
<div>
<p :if={@title} class="font-semibold">{@title}</p>
<p :if={@title} class="admin-alert-title">{@title}</p>
<p>{msg}</p>
</div>
<div class="flex-1" />
<div class="admin-alert-spacer" />
<button type="button" class="group self-start cursor-pointer" aria-label={gettext("close")}>
<.icon name="hero-x-mark" class="size-5 opacity-40 group-hover:opacity-70" />
</button>
@@ -271,7 +271,7 @@ defmodule BerrypodWeb.CoreComponents do
# Helper used by inputs to generate form errors
defp error(assigns) do
~H"""
<p class="admin-error mt-1.5 flex gap-2 items-center text-sm">
<p class="admin-error">
<.icon name="hero-exclamation-circle" class="size-5" />
{render_slot(@inner_block)}
</p>
@@ -287,16 +287,19 @@ defmodule BerrypodWeb.CoreComponents do
def header(assigns) do
~H"""
<header class={[@actions != [] && "flex items-center justify-between gap-6", "pb-4"]}>
<header class={[
"admin-header",
@actions != [] && "admin-header-with-actions"
]}>
<div>
<h1 class="text-lg font-semibold leading-8">
<h1 class="admin-header-title">
{render_slot(@inner_block)}
</h1>
<p :if={@subtitle != []} class="text-sm text-base-content/70">
<p :if={@subtitle != []} class="admin-header-subtitle">
{render_slot(@subtitle)}
</p>
</div>
<div class="flex-none">{render_slot(@actions)}</div>
<div class="admin-header-actions">{render_slot(@actions)}</div>
</header>
"""
end
@@ -352,8 +355,8 @@ defmodule BerrypodWeb.CoreComponents do
>
{render_slot(col, @row_item.(row))}
</td>
<td :if={@action != []} class="w-0 font-semibold">
<div class="flex gap-4">
<td :if={@action != []} class="admin-table-actions">
<div class="admin-table-actions-row">
<%= for action <- @action do %>
{render_slot(action, @row_item.(row))}
<% end %>
@@ -385,7 +388,7 @@ defmodule BerrypodWeb.CoreComponents do
<ul class="admin-list">
<li :for={item <- @item} class="admin-list-row">
<div class="admin-list-grow">
<div class="font-bold">{item.title}</div>
<div class="admin-list-title">{item.title}</div>
<div>{render_slot(item)}</div>
</div>
</li>