defmodule Shino.UI.Card do
@moduledoc """
Provides card related components.
> Displays a card with optional header, content, and footer.
## Examples
```heex
Orders
Recent orders from your store.
<% # the list of orders %>
<% # more controls %>
```
If you only wanna a card skeleton, use `Card.root/1` without header,
content and footer:
```heex
<% # the list of orders, and customize the style as you need %>
```
## References
* [shadcn/ui - Card](https://ui.shadcn.com/docs/components/card)
"""
use Shino.UI, :component
@doc """
The root contains all the parts of a card.
"""
attr :class, :any, default: nil
attr :rest, :global
slot :inner_block, required: true
def root(assigns) do
~H"""
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a card header.
"""
attr :class, :any, default: nil
attr :rest, :global
slot :inner_block, required: true
def header(assigns) do
~H"""
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a card title.
"""
attr :class, :any, default: nil
attr :rest, :global
slot :inner_block, required: true
def title(assigns) do
~H"""
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a card description.
"""
attr :class, :any, default: nil
attr :rest, :global
slot :inner_block, required: true
def description(assigns) do
~H"""
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a card content.
"""
attr :class, :any, default: nil
attr :rest, :global
slot :inner_block, required: true
def content(assigns) do
~H"""
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a card footer.
"""
attr :class, :any, default: nil
attr :rest, :global
slot :inner_block, required: true
def footer(assigns) do
~H"""
<%= render_slot(@inner_block) %>
"""
end
end