48 lines
1.1 KiB
Elixir
48 lines
1.1 KiB
Elixir
defmodule ComfycampWeb.NavBar do
|
|
use Phoenix.Component
|
|
use ComfycampWeb, :verified_routes
|
|
|
|
alias Comfycamp.Accounts.User
|
|
|
|
@doc """
|
|
Navigation bar.
|
|
|
|
## Examples
|
|
|
|
<.navbar current_user={@current_user} />
|
|
"""
|
|
attr :current_user, User, required: false
|
|
|
|
def navbar(assigns) do
|
|
~H"""
|
|
<nav class="limiter navbar">
|
|
<.link href={~p"/"}>Главная</.link>
|
|
<.link href={~p"/notes"}>Заметки</.link>
|
|
<.link href={~p"/cinema"}>Кинотеатр</.link>
|
|
|
|
<div class="space" />
|
|
|
|
<%= if @current_user do %>
|
|
<.link :if={@current_user.is_admin} href={~p"/admin"}>
|
|
Админка
|
|
</.link>
|
|
<.link href={~p"/users/settings"}>
|
|
Настройки
|
|
</.link>
|
|
|
|
<.link href={~p"/users/log_out"} method="delete">
|
|
Выйти
|
|
</.link>
|
|
<% else %>
|
|
<.link href={~p"/users/register"}>
|
|
Зарегистрироваться
|
|
</.link>
|
|
|
|
<.link href={~p"/users/log_in"}>
|
|
Войти
|
|
</.link>
|
|
<% end %>
|
|
</nav>
|
|
"""
|
|
end
|
|
end
|