Add header

This commit is contained in:
Ondřej 2024-08-10 12:33:48 +02:00
parent 3097b0f997
commit 9d95c74aab

View file

@ -7,25 +7,30 @@ defmodule ChoreTrackerWeb.Layouts do
def page_header(assigns) do
~H"""
<header class="border-b col-span-12">
<nav class="flex items-center gap-4 px-6 justify-end">
<%= if @current_user do %>
<p class="text-sm font-medium mr-2">
<%= Accounts.display_user(@current_user) %>
</p>
<.header_link href={~p"/users/settings"}>
Settings
</.header_link>
<.header_link href={~p"/users/log_out"} method="delete">
Log out
</.header_link>
<% else %>
<.header_link href={~p"/users/register"}>
Register
</.header_link>
<.header_link href={~p"/users/log_in"}>
Log in
</.header_link>
<% end %>
<nav class="flex items-center gap-4 px-6 justify-between">
<.link href={~p"/overview"}>
<strong>Chore tracker</strong>
</.link>
<div class="flex items-center gap-4">
<%= if @current_user do %>
<p class="text-sm font-medium mr-2">
<%= Accounts.display_user(@current_user) %>
</p>
<.header_link href={~p"/users/settings"}>
Settings
</.header_link>
<.header_link href={~p"/users/log_out"} method="delete">
Log out
</.header_link>
<% else %>
<.header_link href={~p"/users/register"}>
Register
</.header_link>
<.header_link href={~p"/users/log_in"}>
Log in
</.header_link>
<% end %>
</div>
</nav>
</header>
"""