defmodule SigmaKit.Components.Containers do use Phoenix.LiveComponent attr :shadow, :boolean, default: true, doc: "When true uses a shadow for emphasis" attr :title, :string, default: nil, doc: "The title of the container" attr :class, :any, default: "", doc: "Additional classes to apply to the container" attr :fill, :boolean, default: false, doc: "When true the box will flex to the container" slot :action_bar, doc: "A slot for action buttons" slot :inner_block, doc: "The main content of the container" slot :footer, doc: "Content for a bottom section" def box(assigns) do ~H"""
{@title}
{render_slot(@action_bar)}
{render_slot(@inner_block)}
{render_slot(@footer)}
""" end attr :data, :any, required: true slot :inner_block def async_container(assigns) do ~H""" <.async_result :let={data} assign={@data}> <:loading>
<:failed :let={reason}>
{reason}
{render_slot(@inner_block, data)} """ end end