fix some outstanding issues

This commit is contained in:
Rüdiger Diedrich
2024-06-10 22:08:52 +02:00
parent 6819c81748
commit 8dbfb9ceed
3 changed files with 42 additions and 54 deletions

View File

@ -3,29 +3,29 @@ defmodule HomepageWeb.HelperComponents do
slot :label, required: true
slot :entry, default: []
def dropdown(assigns) do
~H"""
<div class="dropdown dropdown-end">
<label tabindex="0" class="btn btn-ghost m-1">
<%= render_slot(@label) %>
</label>
<ul tabindex="0"
class="dropdown-content menu p-2 shadow rounded-box">
<ul tabindex="0" class="dropdown-content bg-white menu p-2 shadow rounded-box">
<li :for={ent <- @entry}>
<%= render_slot(ent) %>
</li>
</ul>
</div>
"""
"""
end
slot :inner_block, required: true
def markdown(assigns) do
~H"""
<%= render_slot(@inner_block)
|> slot_markdown_as_html()
|> raw()
%>
|> slot_markdown_as_html()
|> raw() %>
"""
end
@ -33,12 +33,12 @@ defmodule HomepageWeb.HelperComponents do
[slot] = dynamic_slot.(false)
slot |> slot_markdown_as_html()
end
defp slot_markdown_as_html(rendered_slot) do
%{static: [markdown]} = rendered_slot
%{static: [markdown]} = rendered_slot
trim_leading_space(markdown)
|> String.replace(~S("\""), ~S("""), global: true)
|> String.replace(~S("\""), ~S("""), global: true)
|> Earmark.as_html!(compact_output: true)
end
@ -60,4 +60,4 @@ defmodule HomepageWeb.HelperComponents do
""
end
end
end
end

View File

@ -1,26 +1,24 @@
<header class="px-4 sm:px-6 lg:px-8">
<.dropdown>
<:label>@rdiedrich</:label>
<:entry>
<.link
title="send an e-mail"
href="mailto:hallo@rdiedri.ch">
<.icon name="hero-envelope" />
hallo@rdiedri.ch
</.link>
</:entry>
<div class="navbar">
<.dropdown>
<:label>@rdiedrich</:label>
<:entry>
<.link title="send an e-mail" href="mailto:hallo@rdiedri.ch">
<.icon name="hero-envelope" /> hallo@rdiedri.ch
</.link>
</:entry>
<:entry>
<.link
title="chat with me on matrix"
href="https://matrix.to/#/@rdiedrich:matrix.org"
target="_blank">
<.icon name="hero-chat-bubble-bottom-center-text" />
@rdiedrich:matrix.org
</.link>
</:entry>
</.dropdown>
<:entry>
<.link
title="chat with me on matrix"
href="https://matrix.to/#/@rdiedrich:matrix.org"
target="_blank"
>
<.icon name="hero-chat-bubble-bottom-center-text" /> @rdiedrich:matrix.org
</.link>
</:entry>
</.dropdown>
</div>
</header>
<main class="px-4 py-20 sm:px-6 lg:px-8">
<div class="mx-auto max-w-2xl space-y-16">
@ -28,5 +26,4 @@
<%= @inner_content %>
</div>
</main>
<footer>
</footer>
<footer></footer>