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
|
2021-07-07 20:32:49 +08:00
|
|
|
~H"""
|
2021-03-31 04:16:42 +08:00
|
|
|
<div class="relative top-0.5 m-0 flex justify-center" data-element="insert-buttons">
|
2021-07-07 20:32:49 +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"
|
2021-07-07 20:32:49 +08:00
|
|
|
phx-value-section_id={@section_id}
|
|
|
|
phx-value-index={@insert_cell_index}
|
2021-03-25 05:26:26 +08:00
|
|
|
>+ 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"
|
2021-07-07 20:32:49 +08:00
|
|
|
phx-value-section_id={@section_id}
|
|
|
|
phx-value-index={@insert_cell_index}
|
2021-03-25 05:26:26 +08:00
|
|
|
>+ Elixir</button>
|
2021-06-08 18:33:50 +08:00
|
|
|
<button class="button button-small"
|
|
|
|
phx-click="insert_cell"
|
|
|
|
phx-value-type="input"
|
2021-07-07 20:32:49 +08:00
|
|
|
phx-value-section_id={@section_id}
|
|
|
|
phx-value-index={@insert_cell_index}
|
2021-06-08 18:33:50 +08:00
|
|
|
>+ Input</button>
|
2021-06-29 05:46:50 +08:00
|
|
|
<button class="button button-small"
|
|
|
|
phx-click="insert_section_into"
|
2021-07-07 20:32:49 +08:00
|
|
|
phx-value-section_id={@section_id}
|
|
|
|
phx-value-index={@insert_cell_index}
|
2021-06-29 05:46:50 +08:00
|
|
|
>+ Section</button>
|
2021-03-25 01:37:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|