Current section
Files
Jump to
Current section
Files
lib/components/containers.ex
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"
slot :action_bar, doc: "A slot for action buttons"
slot :inner_block, doc: "The main content of the container"
def box(assigns) do
~H"""
<div class={[
"border-zinc-100 border rounded-lg p-4",
@shadow && "shadow-lg",
@class
]}>
<div :if={!Enum.empty?(@action_bar) || @title} class="flex 4 justify-between my-2 h-8">
<div class="font-medium text-lg">
{@title}
</div>
<div class="flex gap-4 justify-end">
{render_slot(@action_bar)}
</div>
</div>
{render_slot(@inner_block)}
</div>
"""
end
end