defmodule ToweropsWeb.Components.Skeletons do @moduledoc """ Loading skeleton components for placeholder UI during data fetches. """ use Phoenix.Component # Reusable skeleton block — a single pulsing bar defp skel(assigns) do assigns = assign_new(assigns, :class, fn -> "" end) ~H"""
""" end @doc """ A pulsing card placeholder matching stat cards. """ attr :class, :string, default: nil def skeleton_card(assigns) do ~H"""
<.skel class="h-3 w-24" /> <.skel class="mt-3 h-8 w-16" /> <.skel class="mt-2 h-3 w-20" />
""" end @doc """ Table rows with pulsing placeholders. """ attr :rows, :integer, default: 5 attr :cols, :integer, default: 4 def skeleton_table(assigns) do ~H"""
""" end @doc """ A stat card skeleton (number + label placeholder). """ attr :class, :string, default: nil def skeleton_stat(assigns) do ~H"""
""" end @doc """ Dashboard loading skeleton — mirrors the real dashboard layout. """ def skeleton_dashboard(assigns) do ~H"""
<.skeleton_stat :for={_ <- 1..6} />
""" end end