sloane.sh/lib/sloane_sh/layouts/partials.ex

34 lines
1.2 KiB
Elixir
Raw Normal View History

defmodule SloaneSH.Layouts.Partials do
@moduledoc """
HTML partials for use in HTML layouts
"""
2024-02-23 22:41:26 -05:00
require EEx
2024-02-24 13:40:20 -05:00
import SloaneSH.Layouts.Helpers, warn: false
2024-02-23 22:41:26 -05:00
EEx.function_from_string(
:def,
:header,
~S"""
2024-02-24 19:31:09 -05:00
<header class="flex flex-row justify-between gap-2 pb-4 mb-2" data-pagefind-ignore>
<div class="flex flex-col justify-end">
<%= if attrs[:title] do %>
<h1 class="text-3xl font-extrabold"><%= attrs[:title] %></h1>
<% end %>
</div>
<div class="flex flex-col gap-2 items-end">
2024-02-24 21:11:19 -05:00
<div class="flex flex-row gap-2 items-center">
<a href="/"><span class="text-lg font-bold">sloane.sh</span></a>
<%= picture(ctx, "/assets/images/heart.png", "a purple heart emoji", "w-4 h-4") %>
</div>
2024-02-24 19:31:09 -05:00
<nav class="flex flex-row gap-2">
<a href="/" class="<%= cx(underline: attrs[:permalink] == "/") %>">home</a>
2024-02-24 10:32:07 -05:00
<a href="/posts" class="<%= cx(underline: Map.get(attrs, :permalink, "") =~ ~r[^/posts]) %>">posts</a>
<a href="/search" class="<%= cx(underline: attrs[:permalink] == "/search") %>">search</a>
2024-02-23 22:41:26 -05:00
</nav>
2024-02-24 08:43:08 -05:00
</div>
</header>
2024-02-23 22:41:26 -05:00
""",
[:ctx, :attrs]
)
end