2021-03-04 05:56:28 +08:00
|
|
|
defmodule LivebookWeb.InsertCellComponent do
|
|
|
|
use LivebookWeb, :live_component
|
2021-01-18 05:03:03 +08:00
|
|
|
|
|
|
|
def render(assigns) do
|
|
|
|
~L"""
|
2021-02-18 22:11:24 +08:00
|
|
|
<div class="<%= if(@persistent, do: "opacity-100", else: "opacity-0") %> hover:opacity-100 flex space-x-2 justify-center items-center">
|
2021-01-18 05:03:03 +08:00
|
|
|
<%= line() %>
|
2021-02-18 22:11:24 +08:00
|
|
|
<button class="py-1 px-2 rounded-md text-sm hover:bg-gray-50 border border-gray-200"
|
2021-01-18 05:03:03 +08:00
|
|
|
phx-click="insert_cell"
|
|
|
|
phx-value-type="markdown"
|
|
|
|
phx-value-section_id="<%= @section_id %>"
|
2021-02-11 23:35:32 +08:00
|
|
|
phx-value-index="<%= @index %>">
|
2021-01-18 05:03:03 +08:00
|
|
|
+ Markdown
|
|
|
|
</button>
|
2021-02-18 22:11:24 +08:00
|
|
|
<button class="py-1 px-2 rounded-md text-sm hover:bg-gray-50 border border-gray-200"
|
2021-01-18 05:03:03 +08:00
|
|
|
phx-click="insert_cell"
|
|
|
|
phx-value-type="elixir"
|
|
|
|
phx-value-section_id="<%= @section_id %>"
|
2021-02-11 23:35:32 +08:00
|
|
|
phx-value-index="<%= @index %>">
|
2021-01-18 05:03:03 +08:00
|
|
|
+ Elixir
|
|
|
|
</button>
|
|
|
|
<%= line() %>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
|
|
|
|
defp line() do
|
2021-02-03 02:58:06 +08:00
|
|
|
assigns = %{}
|
|
|
|
|
|
|
|
~L"""
|
2021-01-18 05:03:03 +08:00
|
|
|
<div class="border-t-2 border-dashed border-gray-200 flex-grow"></div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|