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-11-17 04:57:10 +08:00
|
|
|
<div class="relative top-0.5 m-0 flex justify-center"
|
|
|
|
role="toolbar"
|
|
|
|
aria-label="insert new"
|
|
|
|
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-12-04 04:57:21 +08:00
|
|
|
<button class="button-base button-small"
|
2021-11-17 04:57:10 +08:00
|
|
|
phx-click="insert_cell_below"
|
2021-03-25 05:26:26 +08:00
|
|
|
phx-value-type="markdown"
|
2021-07-07 20:32:49 +08:00
|
|
|
phx-value-section_id={@section_id}
|
2021-11-17 04:57:10 +08:00
|
|
|
phx-value-cell_id={@cell_id}
|
2021-03-25 05:26:26 +08:00
|
|
|
>+ Markdown</button>
|
2021-12-04 04:57:21 +08:00
|
|
|
<button class="button-base button-small"
|
2021-11-17 04:57:10 +08:00
|
|
|
phx-click="insert_cell_below"
|
2021-03-25 05:26:26 +08:00
|
|
|
phx-value-type="elixir"
|
2021-07-07 20:32:49 +08:00
|
|
|
phx-value-section_id={@section_id}
|
2021-11-17 04:57:10 +08:00
|
|
|
phx-value-cell_id={@cell_id}
|
2021-03-25 05:26:26 +08:00
|
|
|
>+ Elixir</button>
|
2021-12-04 04:57:21 +08:00
|
|
|
<button class="button-base button-small"
|
2021-11-17 04:57:10 +08:00
|
|
|
phx-click="insert_section_below"
|
2021-07-07 20:32:49 +08:00
|
|
|
phx-value-section_id={@section_id}
|
2021-11-17 04:57:10 +08:00
|
|
|
phx-value-cell_id={@cell_id}
|
2021-06-29 05:46:50 +08:00
|
|
|
>+ Section</button>
|
2021-03-25 01:37:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
|
|
|
end
|