defmodule LivebookWeb.SectionComponent do use LivebookWeb, :live_component def render(assigns) do ~L"""

<%= @section_view.name %>

<%# ^ Note it's important there's no space between

and

because we want the content to exactly match section name. %>
<%= for {cell_view, index} <- Enum.with_index(@section_view.cell_views) do %> <%= live_component @socket, LivebookWeb.InsertButtonsComponent, id: "#{@section_view.id}:#{index}", persistent: false, section_id: @section_view.id, insert_cell_index: index, insert_section_index: nil %> <%= live_component @socket, LivebookWeb.CellComponent, id: cell_view.id, session_id: @session_id, cell_view: cell_view %> <% end %> <%= live_component @socket, LivebookWeb.InsertButtonsComponent, id: "#{@section_view.id}:last", persistent: @section_view.cell_views == [], section_id: @section_view.id, insert_cell_index: length(@section_view.cell_views), insert_section_index: @index + 1 %>
""" end end