Skip to content

Commit

Permalink
Small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cibernox committed Dec 18, 2024
1 parent 4295f39 commit 3fce1b5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ defmodule Beacon.LiveAdmin.VisualEditor.NameValueControl do
</:header>
<.form :let={f} for={@form} id={@id <> "-form"} phx-target={@myself} phx-submit="save" phx-change="validate">
<.input :if={@attribute.editing} field={f[:name]} placeholder="Name" class="w-full py-1 px-2 bg-gray-100 border-gray-100 rounded-md leading-6 text-sm" />
<.input :if={@attribute.editing} field={f[:value]} placeholder="Value" class="w-full py-1 px-2 bg-gray-100 border-gray-100 rounded-md leading-6 text-sm" />
<.input :if={!@attribute.editing} field={f[:name]} placeholder="Name" class="w-full py-1 px-2 bg-gray-100 border-gray-100 rounded-md leading-6 text-sm cursor-not-allowed" disabled />
<.input :if={!@attribute.editing} field={f[:value]} placeholder="Value" class="w-full py-1 px-2 bg-gray-100 border-gray-100 rounded-md leading-6 text-sm cursor-not-allowed" disabled />
<.input
field={f[:name]}
placeholder="Name"
class={"w-full mb-2 py-1 px-2 bg-gray-100 border-gray-100 rounded-md leading-6 text-sm #{if !@attribute.editing, do: "cursor-not-allowed"}"}
disabled={!@attribute.editing}
/>
<.input
field={f[:value]}
placeholder="Value"
class={"w-full py-1 px-2 bg-gray-100 border-gray-100 rounded-md leading-6 text-sm #{if !@attribute.editing, do: "cursor-not-allowed"}"}
disabled={!@attribute.editing}
/>
<.button :if={@attribute.editing} phx-disable-with="Saving..." class="">Save</.button>
<.button :if={@attribute.editing} type="button" phx-target={@myself} phx-click="discard">Discard</.button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,17 @@ defmodule Beacon.LiveAdmin.VisualEditor.PropertiesSidebarComponent do
<%= for attribute <- @other_attributes do %>
<.live_component module={VisualEditor.NameValueControl} id={attribute.id} path={@selected_element["path"]} parent={@myself} attribute={attribute} />
<% end %>
<button
:if={!@editing}
type="button"
class="bg-blue-500 hover:bg-blue-700 active:bg-blue-800 text-white font-bold py-2 px-4 rounded outline-2 w-full"
phx-click="add_attribute"
phx-target={@myself}
>
+ Add attribute
</button>
<div class="p-4">
<button
:if={!@editing}
type="button"
class="bg-blue-500 hover:bg-blue-700 active:bg-blue-800 text-white font-bold py-2 px-4 rounded outline-2 w-full"
phx-click="add_attribute"
phx-target={@myself}
>
+ Add attribute
</button>
</div>
<% end %>
</div>
</div>
Expand Down

0 comments on commit 3fce1b5

Please sign in to comment.