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 :layout, :atom, default: :list
attr :notes, :list, required: true attr :notes, :list, required: true
attr :show_content, :boolean, default: true
def note_list(assigns) do def note_list(assigns) do
case assigns.layout do case assigns.layout do
@ -133,9 +134,9 @@ defmodule ChiyaWeb.PublicComponents do
<%= for note <- assigns.notes do %> <%= for note <- assigns.notes do %>
<a <a
href={~p"/note/#{note.slug}"} 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"> <span class="text-theme-primary text-lg font-semibold leading-8 flex-1">
<%= note.name %> <%= note.name %>
</span> </span>
@ -144,9 +145,11 @@ defmodule ChiyaWeb.PublicComponents do
</span> </span>
</header> </header>
<%= if assigns.show_content do %>
<p class="text-theme-base"> <p class="text-theme-base">
<%= String.slice(note.content, 0..150) %> <%= String.slice(note.content, 0..150) %>
</p> </p>
<% end %>
</a> </a>
<% end %> <% end %>
</section> </section>

View file

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