Move hub icon inside notebook margins

This commit is contained in:
José Valim 2023-03-05 19:28:47 +01:00
parent 5b9e379f6e
commit 2cd6e52b84

View file

@ -231,16 +231,41 @@ defmodule LivebookWeb.SessionLive do
class="relative w-full max-w-screen-lg px-4 sm:pl-8 sm:pr-16 md:pl-16 pt-4 sm:py-5 mx-auto"
data-el-notebook-content
>
<div
class="flex flex-wrap items-center pb-4 mb-2 border-b border-gray-200"
data-el-notebook-headline
data-focusable-id="notebook"
id="notebook"
phx-hook="Headline"
data-on-value-change="set_notebook_name"
data-metadata="notebook"
>
<div class="flex grow">
<div class="flex flex-nowrap gap-2 pb-4 mb-2 border-b border-gray-200">
<div class="mt-1">
<.menu position={:bottom_left} id="notebook-hub-menu">
<:toggle>
<span class="tooltip right distant relative" data-tooltip="Select one hub">
<div class="border rounded-full border-gray-200 hover:border-gray-300 focus:border-gray-300 w-[40px] h-[40px] flex items-center justify-center">
<span aria-label={@data_view.notebook_hub.hub_name}>
<%= @data_view.notebook_hub.hub_emoji %>
</span>
</div>
</span>
</:toggle>
<.menu_item :for={hub <- @saved_hubs}>
<button
id={"select-hub-#{hub.id}"}
phx-click={JS.push("select_hub", value: %{id: hub.id})}
aria-label={hub.name}
role="menuitem"
>
<%= hub.emoji %>
<span class="ml-2"><%= hub.name %></span>
</button>
</.menu_item>
</.menu>
</div>
<div
class="grow"
data-el-notebook-headline
data-focusable-id="notebook"
id="notebook"
phx-hook="Headline"
data-on-value-change="set_notebook_name"
data-metadata="notebook"
>
<h1
class="p-1 text-3xl font-semibold text-gray-800 border border-transparent rounded-lg whitespace-pre-wrap"
tabindex="0"
@ -251,32 +276,7 @@ defmodule LivebookWeb.SessionLive do
><%= @data_view.notebook_name %></h1>
</div>
<div class="flex justify-between items-center pt-1 w-full md:w-auto md:justify-inherit md:items-baseline">
<div class="md:absolute md:left-0">
<.menu position={:bottom_left} id="notebook-hub-menu">
<:toggle>
<span class="tooltip right distant relative" data-tooltip="Select one hub">
<div class="border-2 rounded-full border-gray-200 hover:border-gray-400 focus:border-gray-400 w-[40px] h-[40px] flex items-center justify-center">
<span aria-label={@data_view.notebook_hub.hub_name}>
<%= @data_view.notebook_hub.hub_emoji %>
</span>
</div>
</span>
</:toggle>
<.menu_item :for={hub <- @saved_hubs}>
<button
id={"select-hub-#{hub.id}"}
phx-click={JS.push("select_hub", value: %{id: hub.id})}
aria-label={hub.name}
role="menuitem"
>
<%= hub.emoji %>
<span class="ml-2"><%= hub.name %></span>
</button>
</.menu_item>
</.menu>
</div>
<div class="mt-3">
<.menu id="session-menu">
<:toggle>
<button class="icon-button" aria-label="open notebook menu">