2021-04-23 23:40:13 +08:00
|
|
|
defmodule LivebookWeb.HomeLive.ImportComponent do
|
|
|
|
use LivebookWeb, :live_component
|
|
|
|
|
|
|
|
@impl true
|
|
|
|
def render(assigns) do
|
|
|
|
~L"""
|
2021-04-28 20:28:28 +08:00
|
|
|
<div class="p-6 pb-4 flex flex-col space-y-8">
|
2021-04-23 23:40:13 +08:00
|
|
|
<h3 class="text-2xl font-semibold text-gray-800">
|
|
|
|
Import notebook
|
|
|
|
</h3>
|
|
|
|
<div class="tabs">
|
|
|
|
<%= live_patch to: Routes.home_path(@socket, :import, "url"),
|
|
|
|
class: "tab #{if(@tab == "url", do: "active")}" do %>
|
|
|
|
<%= remix_icon("download-cloud-2-line", class: "align-middle") %>
|
|
|
|
<span class="font-medium">
|
|
|
|
From URL
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
<%= live_patch to: Routes.home_path(@socket, :import, "content"),
|
|
|
|
class: "tab #{if(@tab == "content", do: "active")}" do %>
|
|
|
|
<%= remix_icon("clipboard-line", class: "align-middle") %>
|
|
|
|
<span class="font-medium">
|
|
|
|
From clipboard
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
<div class="flex-grow tab">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<%= case @tab do %>
|
|
|
|
<% "url" -> %>
|
2021-06-03 19:53:03 +08:00
|
|
|
<%= live_component LivebookWeb.HomeLive.ImportUrlComponent,
|
2021-04-23 23:40:13 +08:00
|
|
|
id: "import_url" %>
|
|
|
|
|
|
|
|
<% "content" -> %>
|
2021-06-03 19:53:03 +08:00
|
|
|
<%= live_component LivebookWeb.HomeLive.ImportContentComponent,
|
2021-04-23 23:40:13 +08:00
|
|
|
id: "import_content" %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|