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_patch to: Routes.home_path(@socket, :import, "file_upload"), class: "tab #{if(@tab == "file_upload", do: "active")}" do %> <.remix_icon icon="file-upload-line" class="align-middle" /> File upload <% end %>
<.live_component module={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 defp component_for_tab("file_upload"), do: LivebookWeb.HomeLive.ImportFileUploadComponent end