defmodule LiveBeatsWeb.Layouts do
use LiveBeatsWeb, :html
embed_templates "layouts/*"
attr :id, :string
attr :users, :list
def sidebar_active_users(assigns) do
~H"""
Active Users
<%= for user <- @users do %>
<.link
navigate={profile_path(user)}
class="group flex items-center px-3 py-2 text-base leading-5 font-medium text-gray-600 rounded-md hover:text-gray-900 hover:bg-gray-50"
>
<%= user.username %>
<% end %>
"""
end
attr :id, :string
attr :current_user, :any
attr :active_tab, :atom
def sidebar_nav_links(assigns) do
~H"""
<%= if @current_user do %>
<.link
navigate={profile_path(@current_user)}
class={
"text-gray-700 hover:text-gray-900 group flex items-center px-2 py-2 text-sm font-medium rounded-md #{if @active_tab == :profile, do: "bg-gray-200", else: "hover:bg-gray-50"}"
}
aria-current={if @active_tab == :profile, do: "true", else: "false"}
>
<.icon
name={:music_note}
outlined
class="text-gray-400 group-hover:text-gray-500 mr-3 flex-shrink-0 h-6 w-6"
/> My Songs
<.link
navigate={~p"/profile/settings"}
class={
"text-gray-700 hover:text-gray-900 group flex items-center px-2 py-2 text-sm font-medium rounded-md #{if @active_tab == :settings, do: "bg-gray-200", else: "hover:bg-gray-50"}"
}
aria-current={if @active_tab == :settings, do: "true", else: "false"}
>
<.icon
name={:adjustments}
outlined
class="text-gray-400 group-hover:text-gray-500 mr-3 flex-shrink-0 h-6 w-6"
/> Settings
<% else %>
<.link
navigate={~p"/signin"}
class="text-gray-700 hover:text-gray-900 hover:bg-gray-50 group flex items-center px-2 py-2 text-sm font-medium rounded-md"
>
Sign in
<% end %>
"""
end
attr :id, :string
attr :current_user, :any
def sidebar_account_dropdown(assigns) do
~H"""
<.dropdown id={@id}>
<:img src={@current_user.avatar_url} />
<:title><%= @current_user.name %>
<:subtitle>@<%= @current_user.username %>
<:link navigate={profile_path(@current_user)}>View Profile
<:link navigate={~p"/profile/settings"}>Settings
<:link href={~p"/signout"} method={:delete}>Sign out
"""
end
end