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

Import notebook

<%= live_patch to: Routes.home_path(@socket, :import, "url"), class: "tab #{if(@tab == "url", do: "active")}" do %> <.remix_icon icon="download-cloud-2-line" class="align-middle" /> From URL <% end %> <%= live_patch to: Routes.home_path(@socket, :import, "content"), class: "tab #{if(@tab == "content", do: "active")}" do %> <.remix_icon icon="clipboard-line" class="align-middle" /> From clipboard <% end %>
<%= live_component component_for_tab(@tab), [{:id, "import-#{@tab}"} | @import_opts] %>
""" end defp component_for_tab("url"), do: LivebookWeb.HomeLive.ImportUrlComponent defp component_for_tab("content"), do: LivebookWeb.HomeLive.ImportContentComponent end