defmodule LivebookWeb.SessionLive.DeleteSectionComponent do use LivebookWeb, :live_component @impl true def render(assigns) do ~H"""

Delete section

Are you sure you want to delete this section - “<%= @section.name %>”?

Options

<%# If there is no previous section, all cells need to be deleted %> <.switch_checkbox name="delete_cells" label="Delete all cells in this section" checked={@is_first} disabled={@is_first} />
<%= live_patch "Cancel", to: @return_to, class: "button button-outlined-gray" %>
""" end @impl true def handle_event("delete", params, socket) do delete_cells? = Map.has_key?(params, "delete_cells") Livebook.Session.delete_section( socket.assigns.session_id, socket.assigns.section.id, delete_cells? ) {:noreply, push_patch(socket, to: socket.assigns.return_to)} end end