mitgliederverwaltung/lib/mv_web/components/layouts/navbar.ex
carla b0097ab99d
Some checks failed
continuous-integration/drone/push Build is failing
feat: adds sidebar as overlay and moves navbar content there
2025-12-11 10:11:00 +01:00

48 lines
1.6 KiB
Elixir

defmodule MvWeb.Layouts.Navbar do
@moduledoc """
Navbar that is used in the rootlayout shown on every page
"""
use Phoenix.Component
use Gettext, backend: MvWeb.Gettext
use MvWeb, :verified_routes
attr :current_user, :map,
required: true,
doc: "The current user - navbar is only shown when user is present"
def navbar(assigns) do
~H"""
<header class="shadow-sm navbar bg-base-100">
<div class="flex-1">
<button
type="button"
onclick="document.getElementById('main-drawer').checked = !document.getElementById('main-drawer').checked"
aria-label={gettext("Toggle navigation menu")}
aria-expanded="false"
aria-controls="main-sidebar"
id="sidebar-toggle"
class="mr-2 btn btn-square btn-ghost focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
stroke-linejoin="round"
stroke-linecap="round"
stroke-width="2"
fill="none"
stroke="currentColor"
class="my-1.5 inline-block size-4"
aria-hidden="true"
>
<path d="M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z">
</path>
<path d="M9 4v16"></path>
<path d="M14 10l2 2l-2 2"></path>
</svg>
<span class="sr-only">{gettext("Toggle navigation menu")}</span>
</button>
</div>
</header>
"""
end
end