Update the add_button to add_button_link and remove the extra links.

This commit is contained in:
2025-04-27 15:43:14 +03:00
parent ebbee7f9a5
commit ca1c9c05d2
5 changed files with 28 additions and 19 deletions
@@ -17,7 +17,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents do
only: [
success_button: 1,
primary_button: 1,
add_button: 1,
add_button_link: 1,
save_button: 1,
edit_button: 1,
cancel_button: 1
@@ -69,7 +69,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Buttons do
slot :inner_block, required: true
def add_button(assigns) do
def add_button_link(assigns) do
~H"""
<.link
class={[
@@ -80,8 +80,22 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Buttons do
]}
{@rest}
>
<svg class="w-6 h-6 text-white dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14m-7 7V5"/>
<svg
class="w-6 h-6 text-white dark:text-white"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M5 12h14m-7 7V5"
/>
</svg>
{render_slot(@inner_block)}
</.link>
@@ -12,11 +12,9 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Show do
<:actions>
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %>
<div class="flex flex-row gap-2">
<.link patch={~p"/authors/#{@author}/new"}>
<.add_button>
Alias
</.add_button>
</.link>
<.add_button_link patch={~p"/authors/#{@author}/new"}>
Alias
</.add_button_link>
<.link patch={~p"/authors/#{@author}/edit"}>
<.edit_button>
Edit
@@ -169,10 +169,9 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
</tbody>
</table>
<.add_button phx-click="add-bid" phx-target={@myself} class="w-44">
<.add_button_link phx-click="add-bid" phx-target={@myself} class="w-44">
Add Book Id
</.add_button>
</.add_button_link>
"""
end
@@ -260,9 +259,9 @@ defmodule DecentralisedBookIndexWeb.BookLive.FormComponent do
</tbody>
</table>
<.add_button phx-click="add-author-role" phx-target={@myself} class="w-40">
<.add_button_link phx-click="add-author-role" phx-target={@myself} class="w-40">
Add Author
</.add_button>
</.add_button_link>
"""
end
@@ -16,11 +16,9 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
<:actions>
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %>
<div class="flex flex-row gap-2">
<.link patch={~p"/books/#{@book}/new"}>
<.add_button>
Edition
</.add_button>
</.link>
<.add_button_link patch={~p"/books/#{@book}/new"}>
Edition
</.add_button_link>
<.link patch={~p"/books/#{@book}/edit"}>
<.edit_button>
Edit