defmodule RiverConnectWeb.Components.UI.Card do
@moduledoc """
Card components for containing content and actions.
Cards provide a flexible container for displaying content with support for headers,
footers, and various content layouts. They organize information and actions consistently.
"""
use RiverConnectWeb.Components.UI, :component
@doc """
Renders a card container.
## Examples:
<.card>
<.card_header>
<.card_title>Account Settings
<.card_description>Manage your account settings.
<.card_content>
Your account details and preferences.
<.card_footer>
<.button variant="outline">Cancel
<.button>Save
"""
attr :class, :string, default: nil
slot :inner_block, required: true
attr :rest, :global
def card(assigns) do
~H"""
{render_slot(@inner_block)}
"""
end
@doc """
Renders a card header section for title and description.
"""
attr :class, :string, default: nil
slot :inner_block, required: true
attr :rest, :global
def card_header(assigns) do
~H"""
{render_slot(@inner_block)}
"""
end
@doc """
Renders a card title within the header section.
"""
attr :class, :string, default: nil
slot :inner_block, required: true
attr :rest, :global
def card_title(assigns) do
~H"""
{render_slot(@inner_block)}
"""
end
@doc """
Renders a card description within the header section.
"""
attr :class, :string, default: nil
slot :inner_block, required: true
attr :rest, :global
def card_description(assigns) do
~H"""
{render_slot(@inner_block)}
"""
end
@doc """
Renders the main content area of the card.
"""
attr :class, :string, default: nil
slot :inner_block, required: true
attr :rest, :global
def card_content(assigns) do
~H"""
{render_slot(@inner_block)}
"""
end
@doc """
Renders a footer section for the card, typically containing actions.
"""
attr :class, :string, default: nil
slot :inner_block, required: true
attr :rest, :global
def card_footer(assigns) do
~H"""
{render_slot(@inner_block)}
"""
end
end