defmodule LivebookWeb.HomeLive.ImportUrlComponent do use LivebookWeb, :live_component alias Livebook.{Utils, Notebook} @impl true def mount(socket) do {:ok, assign(socket, url: "", error_message: nil)} end @impl true def update(assigns, socket) do if url = assigns[:url] do {:ok, do_import(socket, url)} else {:ok, socket} end end @impl true def render(assigns) do ~H"""
Paste the URL to a .livemd file, to a GitHub file, or to a Gist.
<.form :let={f} for={:data} phx-submit="import" phx-change="validate" phx-target={@myself} autocomplete="off" > <%= text_input(f, :url, value: @url, class: "input", placeholder: "Notebook URL", autofocus: true, aria_labelledby: "import-from-url", spellcheck: "false" ) %>