2024-07-21 22:03:50 +05:00
|
|
|
|
defmodule ComfycampWeb.NavBar do
|
|
|
|
|
use Phoenix.Component
|
|
|
|
|
|
|
|
|
|
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="/">Главная</.link>
|
2024-07-23 18:51:58 +05:00
|
|
|
|
<.link href="/blog/">Блог</.link>
|
2024-07-21 22:03:50 +05:00
|
|
|
|
<.link href="/cinema/">Кинотеатр</.link>
|
|
|
|
|
|
|
|
|
|
<div class="space" />
|
|
|
|
|
|
|
|
|
|
<%= if @current_user do %>
|
|
|
|
|
<.link href="/users/settings">
|
|
|
|
|
Настройки
|
|
|
|
|
</.link>
|
|
|
|
|
|
|
|
|
|
<.link href="/users/log_out" method="delete">
|
|
|
|
|
Выйти
|
|
|
|
|
</.link>
|
|
|
|
|
<% else %>
|
|
|
|
|
<.link href="/users/register">
|
|
|
|
|
Зарегистрироваться
|
|
|
|
|
</.link>
|
|
|
|
|
|
|
|
|
|
<.link href="/users/log_in">
|
|
|
|
|
Войти
|
|
|
|
|
</.link>
|
|
|
|
|
<% end %>
|
|
|
|
|
</nav>
|
|
|
|
|
"""
|
|
|
|
|
end
|
|
|
|
|
end
|