devel #193

Merged
inhji merged 9 commits from devel into main 2023-07-07 13:55:59 +02:00
8 changed files with 144 additions and 133 deletions

View file

@ -72,9 +72,7 @@
</header>
<main class="mx-3 md:mx-0">
<section class="mx-auto max-w-2xl">
<%= @inner_content %>
</section>
<%= @inner_content %>
</main>
<footer class="max-w-full mt-8 p-8 text-theme-base/75 bg-theme-background1">

View file

@ -66,12 +66,13 @@ defmodule ChiyaWeb.PublicComponents do
end
attr :note, :map, required: true
attr :class_tag, :string, default: ""
def tags(assigns) do
~H"""
<span class="inline-flex flex-row gap-1">
<%= for tag <- @note.tags do %>
<a href={~p"/tagged-with/#{tag.slug}"} class="underline-link font-semibold | p-category">
<a href={~p"/tagged-with/#{tag.slug}"} class={["p-category", @class_tag]}>
<%= tag.name %>
</a>
<% end %>

View file

@ -1,24 +1,26 @@
<article class="h-card hcard">
<section class="p-10 bg-theme-background1 flex gap-3 items-start">
<div>
<img
class="rounded-lg w-28 | u-photo"
src={ChiyaWeb.Uploaders.UserImage.url({@user.user_image, @current_user}, :thumb)}
/>
</div>
<div>
<h1 class="text-3xl font-extrabold leading-10 tracking-tight text-theme-primary | p-name">
<%= @user.name %>
</h1>
<section class="mx-auto mt-8 prose prose-gruvbox | p-note">
<%= Markdown.render(@user.bio) |> raw() %>
</section>
</div>
</section>
<%= if @note do %>
<section class="mx-auto mt-8 prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
<%= Markdown.render(@note.content) |> raw %>
<section class="max-w-2xl mx-auto">
<article class="h-card hcard">
<section class="p-10 bg-theme-background1 flex gap-3 items-start">
<div>
<img
class="rounded-lg w-28 | u-photo"
src={ChiyaWeb.Uploaders.UserImage.url({@user.user_image, @current_user}, :thumb)}
/>
</div>
<div>
<h1 class="text-3xl font-extrabold leading-10 tracking-tight text-theme-primary | p-name">
<%= @user.name %>
</h1>
<section class="mx-auto mt-8 prose prose-gruvbox | p-note">
<%= Markdown.render(@user.bio) |> raw() %>
</section>
</div>
</section>
<% end %>
</article>
<%= if @note do %>
<section class="mx-auto mt-8 prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
<%= Markdown.render(@note.content) |> raw %>
</section>
<% end %>
</article>
</section>

View file

@ -1,8 +1,10 @@
<.header>
<:title><%= @channel.name %></:title>
<:subtitle><%= @channel.content %></:subtitle>
</.header>
<section class="max-w-2xl mx-auto">
<.header>
<:title><%= @channel.name %></:title>
<:subtitle><%= @channel.content %></:subtitle>
</.header>
<div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5">
<.note_list notes={@channel.notes} layout={@channel.layout} />
</div>
<div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5">
<.note_list notes={@channel.notes} layout={@channel.layout} />
</div>
</section>

View file

@ -1,33 +1,35 @@
<.header class_title="text-theme-primary p-name" class_subtitle="p-summary">
<:title><%= @settings.title %></:title>
<:subtitle><%= @settings.subtitle %></:subtitle>
</.header>
<section class="max-w-2xl mx-auto">
<.header class_title="text-theme-primary p-name" class_subtitle="p-summary">
<:title><%= @settings.title %></:title>
<:subtitle><%= @settings.subtitle %></:subtitle>
</.header>
<section class="text-sm my-8">
<ul class="flex flex-wrap gap-3">
<li>
<a
href="#"
class="inline-block text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold"
>
<.icon name="hero-megaphone" />
</a>
</li>
<%= for channel <- @channels do %>
<section class="text-sm my-8">
<ul class="flex flex-wrap gap-3">
<li>
<a
href={~p"/channel/#{channel.slug}"}
href="#"
class="inline-block text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold"
>
<%= channel.name %>
<.icon name="hero-megaphone" />
</a>
</li>
<% end %>
</ul>
</section>
<%= if @channel do %>
<section class="mt-8">
<.note_list notes={@channel.notes} layout={@channel.layout} />
<%= for channel <- @channels do %>
<li>
<a
href={~p"/channel/#{channel.slug}"}
class="inline-block text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold"
>
<%= channel.name %>
</a>
</li>
<% end %>
</ul>
</section>
<% end %>
<%= if @channel do %>
<section class="mt-8">
<.note_list notes={@channel.notes} layout={@channel.layout} />
</section>
<% end %>
</section>

View file

@ -1,57 +1,59 @@
<article class="h-entry hentry">
<.header class_title="p-name">
<:title><%= @note.name %></:title>
</.header>
<section class="max-w-2xl mx-auto">
<article class="h-entry hentry">
<.header class_title="p-name">
<:title><%= @note.name %></:title>
</.header>
<section class="mt-8 prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
<%= Markdown.render(@note.content) |> raw %>
</section>
<section class="mt-8 prose prose-gruvbox md:prose-lg lg:prose-xl | p-summary e-content">
<%= Markdown.render(@note.content) |> raw %>
</section>
<footer class="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 %>
<footer class="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>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 %>
<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>
<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="mt-8">
<%= if !Enum.empty?(@note.images) do %>
<.line />
<section class="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>
<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>
</section>

View file

@ -1,8 +1,10 @@
<.header>
<:title>Tagged with &ldquo;<%= @tag.name %>&rdquo;</:title>
<:subtitle><%= @tag.content %></:subtitle>
</.header>
<section class="max-w-2xl mx-auto">
<.header>
<:title>Tagged with &ldquo;<%= @tag.name %>&rdquo;</:title>
<:subtitle><%= @tag.content %></:subtitle>
</.header>
<div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5">
<.note_list notes={@tag.notes} />
</div>
<div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5">
<.note_list notes={@tag.notes} />
</div>
</section>

View file

@ -1,19 +1,21 @@
<.header>
<:title>Wiki</:title>
</.header>
<section class="w-full px-3">
<.header>
<:title>Wiki</:title>
</.header>
<section class="prose prose-gruvbox">
<%= Markdown.render(@channel.content) |> raw %>
</section>
<section class="prose prose-gruvbox">
<%= Markdown.render(@channel.content) |> raw %>
</section>
<%= if @channel do %>
<section class="flex flex-col md:col-row">
<div class="w-full mt-6 sm:w-auto flex flex-1 flex-col gap-1.5">
<.note_list notes={@notes_updated} layout={@channel.layout} />
</div>
<%= if @channel do %>
<section class="flex flex-col md:flex-row">
<div class="w-full mt-6 sm:w-auto flex flex-1 flex-col gap-1.5">
<.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">
<.note_list notes={@notes_published} layout={@channel.layout} />
</div>
</section>
<% end %>
<div class="w-full mt-6 sm:w-auto flex flex-1 flex-col gap-1.5">
<.note_list notes={@notes_published} layout={@channel.layout} />
</div>
</section>
<% end %>
</section>