defmodule LivebookWeb.OpenLive.UrlComponent 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={%{"url" => @url}} as={:data} phx-submit="import" phx-change="validate" phx-target={@myself} autocomplete="off" > <.text_field field={f[:url]} label="Notebook URL" autofocus aria-labelledby="import-from-url" spellcheck="false" />