„lib/chiya_web/components/public_components.ex“ ändern

This commit is contained in:
inhji 2023-07-05 16:40:11 +02:00
parent 2e5c36042e
commit fdff48d197

View file

@ -69,30 +69,19 @@ defmodule ChiyaWeb.PublicComponents do
Renders a note-header with title.
"""
attr :class, :string, default: nil
attr :inline, :boolean, default: false
slot :inner_block, required: true
slot :title, required: true
slot :subtitle
slot :actions
def header(assigns) do
~H"""
<header class={[@actions != [] && "flex items-center justify-between gap-6", @class]}>
<div>
<h1 class="text-lg font-semibold leading-8 text-gray-800 dark:text-gray-200">
<%= render_slot(@inner_block) %>
<span :if={@inline} class="text-sm leading-6 font-normal text-gray-600 dark:text-gray-400">
<%= render_slot(@subtitle) %>
</span>
</h1>
<p
:if={@subtitle != [] && @inline == false}
class="mt-2 text-sm leading-6 text-gray-600 dark:text-gray-400"
>
<%= render_slot(@subtitle) %>
</p>
</div>
<div class="flex-none"><%= render_slot(@actions) %></div>
<header class={["p-8 rounded", @class]}>
<h1 class="text-3xl font-extrabold leading-10 tracking-tight text-theme-primary">
<%= render_slot(@title) %>
</h1>
<p :if={@subtitle != []} class="mt-4 leading-7 text-theme-base/75 uppercase font-semibold">
<%= render_slot(@subtitle) %>
</p>
</header>
"""
end