livebook/lib/livebook_web/live/session_live/insert_buttons_component.ex
Jonatan Kłosko c1654345b7
Migrate to latest LV (#437)
* Update phoenix deps

* Update reference to LiveDashboard encode_pid

* Fix form input id references

* Move to HEEx

* Update back to filesystem LV npm package

* Further HEEx rewrites

* Refactor icons into function components

* .html.leex -> .html.heex

* Further refactoring

* Move render helpers into function components

* Add doctype back

* Further refactoring

* Refactor cell component

* Further refactoring

* Compose sidebar using function components

* Rewrite notebook card component as function component

* Fruther refactoring

* Fix race condition in runtime tests

* Rewrite tooltips into function component

* Update Tailwind purge rules

* Revert "Rewrite tooltips into function component"

This reverts commit bd6ca8f0b5.

* Refactor conditional tooltip
2021-07-07 14:32:49 +02:00

36 lines
1.3 KiB
Elixir

defmodule LivebookWeb.SessionLive.InsertButtonsComponent do
use LivebookWeb, :live_component
def render(assigns) do
~H"""
<div class="relative top-0.5 m-0 flex justify-center" data-element="insert-buttons">
<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"}>
<button class="button button-small"
phx-click="insert_cell"
phx-value-type="markdown"
phx-value-section_id={@section_id}
phx-value-index={@insert_cell_index}
>+ Markdown</button>
<button class="button button-small"
phx-click="insert_cell"
phx-value-type="elixir"
phx-value-section_id={@section_id}
phx-value-index={@insert_cell_index}
>+ Elixir</button>
<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>
<button class="button button-small"
phx-click="insert_section_into"
phx-value-section_id={@section_id}
phx-value-index={@insert_cell_index}
>+ Section</button>
</div>
</div>
"""
end
end