better admin buttons on note page

This commit is contained in:
Inhji 2023-07-20 20:30:15 +02:00
parent 1b21d525b9
commit 4c59e3413d
5 changed files with 20 additions and 19 deletions

View file

@ -140,7 +140,7 @@
.footnote:before { content: '{'; } .footnote:before { content: '{'; }
.footnote:after { content: '}'; } .footnote:after { content: '}'; }
body > header nav a { a.button {
@apply inline-block text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold; @apply inline-block text-theme-base px-3 py-2.5 border border-theme-background1 hover:bg-theme-background1 rounded transition font-semibold;
} }
} }

View file

@ -30,9 +30,10 @@ defmodule ChiyaWeb.CoreComponents do
""" """
end end
attr :class, :string, default: nil
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", @class]}>
<span class="hidden dark:inline">🌙</span> <span class="hidden dark:inline">🌙</span>
<span class="inline dark:hidden"></span> <span class="inline dark:hidden"></span>
</.link> </.link>

View file

@ -42,30 +42,30 @@
<nav class="mx-auto max-w-2xl"> <nav class="mx-auto max-w-2xl">
<ul class="flex gap-3"> <ul class="flex gap-3">
<li> <li>
<a href="/"> <a href="/" class="button">
<.icon name="hero-home" /> Home <.icon name="hero-home" /> Home
</a> </a>
</li> </li>
<li> <li>
<a href="/about"> <a href="/about" class="button">
<.icon name="hero-face-smile" /> About <.icon name="hero-face-smile" /> About
</a> </a>
</li> </li>
<li> <li>
<a href="/wiki"> <a href="/wiki" class="button">
<.icon name="hero-paper-clip" /> Wiki <.icon name="hero-paper-clip" /> Wiki
</a> </a>
</li> </li>
<%= if @current_user do %> <%= if @current_user do %>
<li> <li>
<a href="/admin"> <a href="/admin" class="button">
<.icon name="hero-beaker" /> Admin <.icon name="hero-beaker" /> Admin
</a> </a>
</li> </li>
<% end %> <% end %>
<li class="flex-1"></li> <li class="flex-1"></li>
<li> <li>
<.darkmode_toggle /> <.darkmode_toggle class="button" />
</li> </li>
</ul> </ul>
</nav> </nav>

View file

@ -7,19 +7,13 @@
<section class="text-sm my-8"> <section class="text-sm my-8">
<ul class="flex flex-wrap gap-3"> <ul class="flex flex-wrap gap-3">
<li> <li>
<a <a href="#" class="button">
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" /> <.icon name="hero-megaphone" />
</a> </a>
</li> </li>
<%= for channel <- @channels do %> <%= for channel <- @channels do %>
<li> <li>
<a <a href={~p"/channel/#{channel.slug}"} class="button">
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 %> <%= channel.name %>
</a> </a>
</li> </li>

View file

@ -3,6 +3,16 @@
<%= @note.name %> <%= @note.name %>
</.header> </.header>
<%= if @current_user do %>
<section class="max-w-2xl mx-auto mt-8">
<ul class="flex gap-3">
<li><a href={~p"/admin/notes/#{@note}/edit"} class="button">
<.icon name="hero-pencil-square" /> Edit</a></li>
<li><a href={~p"/admin/notes/#{@note}"} class="button">Show in Admin</a></li>
</ul>
</section>
<% end %>
<%= if has_outline?(@note) do %> <%= if has_outline?(@note) do %>
<aside class="max-w-2xl mx-auto mt-8 prose prose-gruvbox"> <aside class="max-w-2xl mx-auto mt-8 prose prose-gruvbox">
<div class="bg-theme-background1 rounded p-2"> <div class="bg-theme-background1 rounded p-2">
@ -54,10 +64,6 @@
<.dot /> <.dot />
<span><%= @note.kind %></span> <span><%= @note.kind %></span>
<% end %> <% 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"/"} class="hidden | h-card u-author">Inhji</a>
<a href={~p"/note/#{@note.slug}"} class="hidden | u-url u-uid"><%= @note.name %></a> <a href={~p"/note/#{@note.slug}"} class="hidden | u-url u-uid"><%= @note.name %></a>