Merge pull request 'devel' (#237) from devel into main

Reviewed-on: #237
This commit is contained in:
inhji 2023-07-27 20:32:22 +02:00
commit 0ddbfece02
2 changed files with 23 additions and 17 deletions

View file

@ -107,6 +107,7 @@ defmodule ChiyaWeb.PublicComponents do
attr :layout, :atom, default: :list
attr :notes, :list, required: true
attr :show_content, :boolean, default: true
def note_list(assigns) do
case assigns.layout do
@ -133,9 +134,9 @@ defmodule ChiyaWeb.PublicComponents do
<%= for note <- assigns.notes do %>
<a
href={~p"/note/#{note.slug}"}
class="rounded-lg px-6 pt-4 pb-5 border border-theme-background1 hover:bg-theme-background1 transition"
class="rounded-lg px-6 py-4 border border-theme-background1 hover:bg-theme-background1 transition"
>
<header class="flex flex-row items-center">
<header class="flex flex-row items-center gap-1">
<span class="text-theme-primary text-lg font-semibold leading-8 flex-1">
<%= note.name %>
</span>
@ -144,9 +145,11 @@ defmodule ChiyaWeb.PublicComponents do
</span>
</header>
<%= if assigns.show_content do %>
<p class="text-theme-base">
<%= String.slice(note.content, 0..150) %>
</p>
<% end %>
</a>
<% end %>
</section>

View file

@ -3,25 +3,28 @@
<.header>
<%= @channel.name %>
</.header>
</section>
<section class="prose prose-gruvbox mt-6">
<section class="mt-6 flex flex-col gap-3 max-w-2xl mx-auto">
<section class="prose prose-gruvbox md:prose-lg lg:prose-xl max-w-none">
<%= Markdown.render(@channel.content) |> raw %>
</section>
<aside class="flex flex-col md:flex-row gap-3 mt-6">
<div class="mt-6 flex flex-1 flex-col gap-1.5">
<h2 class="text-xl text-theme-base">Recently Updated</h2>
<.note_list notes={@notes_updated} layout={@channel.layout} show_content={false} />
</div>
<div class="mt-6 flex flex-1 flex-col gap-1.5">
<h2 class="text-xl text-theme-base">Recently Published</h2>
<.note_list notes={@notes_published} layout={@channel.layout} show_content={false} />
</div>
</aside>
</section>
<section class="flex flex-col md:flex-row gap-3 mt-6 w-full sm:px-3">
<div class="w-full mt-6 sm:w-auto flex flex-1 flex-col gap-1.5">
<h2 class="text-xl text-theme-base">Recently Updated</h2>
<.note_list notes={@notes_updated} layout={@channel.layout} />
</div>
<div class="w-full mt-6 sm:w-auto flex flex-1 flex-col gap-1.5">
<h2 class="text-xl text-theme-base">Recently Published</h2>
<.note_list notes={@notes_published} layout={@channel.layout} />
</div>
</section>
<% else %>
<section class="mx-auto max-w-2xl">
<.header>