defmodule LivebookWeb.SidebarHelpers do
use Phoenix.Component
import LivebookWeb.Helpers
import LivebookWeb.UserHelpers
alias LivebookWeb.Router.Helpers, as: Routes
@doc """
Renders sidebar container.
Other functions in this module render sidebar
items of various type.
"""
def sidebar(assigns) do
~H"""
<%= render_slot(@inner_block) %>
"""
end
def logo_item(assigns) do
~H"""
<%= live_patch to: Routes.home_path(@socket, :page), aria_label: "go to homepage" do %>
<% end %>
"""
end
def button_item(assigns) do
~H"""
"""
end
def link_item(assigns) do
~H"""
<%= live_patch to: @path,
class: "text-gray-400 hover:text-gray-50 focus:text-gray-50 rounded-xl h-10 w-10 flex items-center justify-center #{if(@active, do: "text-gray-50 bg-gray-700")}",
aria_label: @label do %>
<.remix_icon icon={@icon} class="text-2xl" />
<% end %>
"""
end
def break_item(assigns) do
~H"""
"""
end
def user_item(assigns) do
~H"""
<%= live_patch to: @path,
class: "text-gray-400 rounded-xl h-8 w-8 flex items-center justify-center",
aria_label: "user profile" do %>
<.user_avatar user={@current_user} text_class="text-xs" />
<% end %>
"""
end
end