improve menu, fix tag page

This commit is contained in:
Inhji 2023-06-02 07:31:47 +02:00
parent 64d8936436
commit 625cbdd00a
6 changed files with 28 additions and 19 deletions

View file

@ -102,6 +102,10 @@
.footnotes hr { display: none; } .footnotes hr { display: none; }
.footnote:before { content: '{'; } .footnote:before { content: '{'; }
.footnote:after { content: '}'; } .footnote:after { content: '}'; }
body > header nav a {
@apply text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold;
}
} }
@layer utilities { @layer utilities {

View file

@ -33,8 +33,8 @@ defmodule ChiyaWeb.CoreComponents do
def darkmode_toggle(assigns) do def darkmode_toggle(assigns) do
~H""" ~H"""
<.link href="#" id="dark-mode-toggle" class="text-sm leading-6"> <.link href="#" id="dark-mode-toggle" class="text-sm leading-6">
<span class="hidden dark:inline bg-blue-900 p-1 rounded">🌙</span> <span class="hidden dark:inline">🌙</span>
<span class="inline dark:hidden bg-blue-600 p-1 rounded"></span> <span class="inline dark:hidden"></span>
</.link> </.link>
""" """
end end

View file

@ -39,13 +39,19 @@
<nav> <nav>
<ul class="flex gap-3"> <ul class="flex gap-3">
<li> <li>
<a <a href="/">
href="/"
class="text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold"
>
<.icon name="hero-home" /> Home <.icon name="hero-home" /> Home
</a> </a>
</li> </li>
<li>
<a href="/about">
<.icon name="hero-hand-raised" /> About
</a>
</li>
<li class="flex-1"></li>
<li>
<.darkmode_toggle />
</li>
</ul> </ul>
</nav> </nav>
</header> </header>
@ -68,8 +74,6 @@
<span><a href={identity.url}><%= identity.name %></a></span> <span><a href={identity.url}><%= identity.name %></a></span>
<.dot /> <.dot />
<% end %> <% end %>
<span><a href={~p"/note/about"}>About</a></span>
<.dot />
<span><a href={~p"/admin"}>Admin</a></span> <span><a href={~p"/admin"}>Admin</a></span>
</p> </p>
</footer> </footer>

View file

@ -54,4 +54,11 @@ defmodule ChiyaWeb.PageController do
) )
end end
end end
### ========= REDIRECTS
def about(conn, _params) do
redirect(conn, to: ~p"/note/about")
end
end end

View file

@ -1,5 +1,5 @@
<div class="mx-auto max-w-xl mx-4 lg:mx-0"> <div class="mx-auto max-w-xl">
<h1 class="mt-16 text-[2rem] font-semibold font-serif leading-10 tracking-tighter text-theme-heading"> <h1 class="mt-16 text-3xl font-extrabold tracking-tight text-theme-primary">
Tagged with &ldquo;<%= @tag.name %>&rdquo; Tagged with &ldquo;<%= @tag.name %>&rdquo;
</h1> </h1>
<p class="mt-4 text-base leading-7 text-theme-base"> <p class="mt-4 text-base leading-7 text-theme-base">
@ -7,14 +7,6 @@
</p> </p>
<div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5"> <div class="w-full mt-6 sm:w-auto flex flex-col gap-1.5">
<%= for note <- @tag.notes do %> <.note_list notes={@tag.notes} />
<a
href={~p"/note/#{note.slug}"}
class="rounded -mx-2 -my-0.5 px-2 py-0.5 hover:bg-theme-primary/10 transition"
>
<span class="text-theme-primary text-lg font-semibold leading-8"><%= note.name %></span>
<span class="text-theme-base text-sm"><%= pretty_date(note.published_at) %></span>
</a>
<% end %>
</div> </div>
</div> </div>

View file

@ -135,6 +135,8 @@ defmodule ChiyaWeb.Router do
get "/tagged-with/:slug", PageController, :tag get "/tagged-with/:slug", PageController, :tag
get "/", PageController, :home get "/", PageController, :home
get "/about", PageController, :about
post "/note/:slug/comment", CommentController, :create post "/note/:slug/comment", CommentController, :create
end end
end end