defmodule LiveViewUI.Avatar do @moduledoc """ A simple avatar component for displaying user profile images with optional fallbacks. ## Example Usage Here is a basic example of setting up an avatar with an image and a fallback: ```elixir U ``` This structure allows you to display a user's avatar image with a fallback in case the image is not available. """ use Phoenix.Component use CVA.Component import LiveViewUI.Helper attr :class, :any, default: nil attr :rest, :global slot :inner_block, required: true def root(assigns) do ~H"""
<%= render_slot(@inner_block) %>
""" end attr :class, :any, default: nil attr :rest, :global, include: ~w(src alt) def image(assigns) do ~H""" """ end attr :class, :any, default: nil attr :rest, :global slot :inner_block, required: true def fallback(assigns) do ~H"""
<%= render_slot(@inner_block) %>
""" end end