adding a disabled delete button for sections that have branches (#624)

* adding a disabled delete button for sections that have branches

* Apply suggestions from code review

* Update assets/css/components.css

* Apply suggestions from code review

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
This commit is contained in:
Matheus Cumpian 2021-10-20 13:10:11 -03:00 committed by GitHub
parent 93e9b06a29
commit f6d31a7d86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View file

@ -61,7 +61,8 @@
@apply bg-gray-100; @apply bg-gray-100;
} }
.icon-button:disabled { .icon-button:disabled,
.icon-button.disabled {
@apply cursor-default pointer-events-none text-gray-300; @apply cursor-default pointer-events-none text-gray-300;
} }

View file

@ -68,14 +68,12 @@ defmodule LivebookWeb.SessionLive.SectionComponent do
<.remix_icon icon="arrow-down-s-line" class="text-xl" /> <.remix_icon icon="arrow-down-s-line" class="text-xl" />
</button> </button>
</span> </span>
<%= unless @section_view.has_children? do %> <span class="tooltip top" aria-label={if @section_view.has_children?, do: "Cannot delete this section because\nother sections branch from it", else: "Delete"}>
<span class="tooltip top" aria-label="Delete">
<%= live_patch to: Routes.session_path(@socket, :delete_section, @session_id, @section_view.id), <%= live_patch to: Routes.session_path(@socket, :delete_section, @session_id, @section_view.id),
class: "icon-button" do %> class: "icon-button #{if @section_view.has_children?, do: "disabled"}" do %>
<.remix_icon icon="delete-bin-6-line" class="text-xl" /> <.remix_icon icon="delete-bin-6-line" class="text-xl" />
<% end %> <% end %>
</span> </span>
<% end %>
</div> </div>
</div> </div>
<%= if @section_view.parent do %> <%= if @section_view.parent do %>