comfycamp/lib/comfycamp_web/components/navbar.ex

45 lines
939 B
Elixir
Raw Normal View History

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>
<.link href="/services/">Сервисы</.link>
<.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