defmodule Liliform.Page do
use Liliform.Component
import Liliform.Block
import Liliform.Icon
import Liliform.Panel
import Liliform.Control
@doc """
Renders a panel as page.
"""
attr :name, :string, required: true, doc: "page name"
attr :class, :string, default: "", doc: "additional classes"
attr :filters, :list, default: [], doc: "filters"
attr :query, :string, default: "", doc: "search query"
attr :rest, :global
slot :inner_block, required: true
def page(assigns) do
assigns =
assigns
|> set_bulma_classes()
~H"""
<.block class="px-2 py-4">
<.panel class={@class} {@rest} is-info>
<.panel_heading>
<%= @name %>
<.panel_tabs is-hidden-mobile>
<%= for filter <- @filters do %>
<%= filter.title %>
<% end %>
<.panel_tabs is-hidden-tablet>
<%= for filter <- @filters do %>
<.icon for={filter.icon} color="auto" />
<% end %>
<.panel_block>
<.control has-icons-left>
<.icon for="search" size="1.5rem" aria-hidden="true" is-left />
<%= render_slot(@inner_block) %>
"""
end
end