2021-04-02 20:00:49 +08:00
|
|
|
defmodule LivebookWeb.SessionLive.InsertButtonsComponent do
|
2021-03-25 01:37:50 +08:00
|
|
|
use LivebookWeb, :live_component
|
|
|
|
|
|
|
|
def render(assigns) do
|
|
|
|
~L"""
|
2021-03-31 04:16:42 +08:00
|
|
|
<div class="relative top-0.5 m-0 flex justify-center" data-element="insert-buttons">
|
2021-06-18 22:14:20 +08:00
|
|
|
<div class="w-full absolute z-10 <%= if(@persistent, do: "opacity-100", else: "opacity-0") %> hover:opacity-100 focus-within:opacity-100 flex space-x-2 justify-center items-center">
|
2021-03-26 00:39:18 +08:00
|
|
|
<button class="button button-small"
|
2021-03-25 05:26:26 +08:00
|
|
|
phx-click="insert_cell"
|
|
|
|
phx-value-type="markdown"
|
|
|
|
phx-value-section_id="<%= @section_id %>"
|
|
|
|
phx-value-index="<%= @insert_cell_index %>"
|
|
|
|
>+ Markdown</button>
|
2021-03-26 00:39:18 +08:00
|
|
|
<button class="button button-small"
|
2021-03-25 05:26:26 +08:00
|
|
|
phx-click="insert_cell"
|
|
|
|
phx-value-type="elixir"
|
|
|
|
phx-value-section_id="<%= @section_id %>"
|
|
|
|
phx-value-index="<%= @insert_cell_index %>"
|
|
|
|
>+ Elixir</button>
|
2021-06-08 18:33:50 +08:00
|
|
|
<button class="button button-small"
|
|
|
|
phx-click="insert_cell"
|
|
|
|
phx-value-type="input"
|
|
|
|
phx-value-section_id="<%= @section_id %>"
|
|
|
|
phx-value-index="<%= @insert_cell_index %>"
|
|
|
|
>+ Input</button>
|
2021-03-25 05:26:26 +08:00
|
|
|
<%= if @insert_section_index do %>
|
2021-03-26 00:39:18 +08:00
|
|
|
<button class="button button-small"
|
2021-03-25 05:26:26 +08:00
|
|
|
phx-click="insert_section"
|
|
|
|
phx-value-index="<%= @insert_section_index %>"
|
|
|
|
>+ Section</button>
|
|
|
|
<% end %>
|
2021-03-25 01:37:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|