The layout component should implement at least the stack and the sidebar layouts, ref: https://every-layout.dev
The cover would be an excellent addition.
defmodule SesameWeb.Menus do
use SesameWeb, :verified_routes
# Public menu
def public_menu_items(_user \\ nil),
do: [
%{label: "Features", path: "/#features"},
]
# Signed out main menu
def main_menu_items(nil) do
[]
end
# Signed in main menu
def main_menu_items(current_user) do
build_menu([:my_notifications, :participants], current_user)
end
end
Hi,
The layout component should implement at least the stack and the sidebar layouts, ref: https://every-layout.dev The cover would be an excellent addition.
Petal's approach to structure is a decent start https://docs.petal.build/petal-pro-documentation/fundamentals/layouts-and-menus
Here is what I did to port the sidebar layout from the https://github.com/themesberg/flowbite-astro-admin-dashboard/tree/main (it also implements the stack) into one of my experiments.
main
tagcomponents/astro.ex
I don't remember much now, but
astro/sidebar.ex
andastro/navbar_sidebar.ex
basically loop over the menu items and render them accordingly:Then, I was able to choose which layout I wanted to use on a LiveView basis:
The
SesameWeb.Menus
contains definitions of menus as described in Petal docs https://docs.petal.build/petal-pro-documentation/fundamentals/layouts-and-menus#menusHope this helps!