chiya/lib/chiya_web/controllers/page_html/note.html.heex

61 lines
2 KiB
Text

<article class="h-entry hentry">
<.header class="max-w-2xl mx-auto" class_title="p-name">
<%= @note.name %>
</.header>
<aside class="max-w-2xl mx-auto mt-8 prose prose-gruvbox bg-theme-background1 rounded p-2 empty:hidden">
<%= raw Enum.map(render_outline(@note), &safe_to_string/1) %>
</aside>
<section class="mt-8 mx-auto prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
<%= Markdown.render(@note.content) |> raw %>
</section>
<footer class="max-w-2xl mx-auto mt-8 text-theme-base">
<%= if @note.published_at do %>
<span>Published</span>
<% else %>
<span>Unpublished</span>
<% end %>
<time class="font-semibold | dt-published"><%= pretty_date(@note.published_at) %></time>
<.dot />
<span>Last Updated</span>
<time class="font-semibold" datetime={datetime(@note.updated_at)}>
<%= pretty_date(@note.updated_at) %>
</time>
<%= if not Enum.empty?(@note.tags) do %>
<.dot />
<span>Tags</span>
<.tags note={@note} />
<% end %>
<%= if @current_user do %>
<.dot />
<a href={~p"/admin/notes/#{@note}"} class="underline-link font-semibold">Show in Admin</a>
<% end %>
<a href={~p"/"} class="hidden | h-card u-author">Inhji</a>
<a href={~p"/note/#{@note.slug}"} class="hidden | u-url u-uid"><%= @note.name %></a>
</footer>
<section class="max-w-2xl mx-auto mt-8">
<%= if !Enum.empty?(@note.images) do %>
<.line />
<div class="flex flex-wrap gap-3">
<%= for image <- @note.images do %>
<a
href={ChiyaWeb.Uploaders.NoteImage.url({image.path, image}, :full_dithered)}
class="lightbox | w-28"
data-gallery="note"
data-description={ChiyaWeb.Markdown.render(image.content)}
>
<img
src={ChiyaWeb.Uploaders.NoteImage.url({image.path, image}, :thumb_dithered)}
class="rounded"
/>
</a>
<% end %>
</div>
<% end %>
</section>
</article>