From eff06c0da6f1560d6645e7c769770b804297dad2 Mon Sep 17 00:00:00 2001 From: Haelnorr Date: Fri, 14 Feb 2025 13:46:52 +1100 Subject: [PATCH] Added dropdown to profile button --- view/component/nav/navbarright.templ | 78 +++++++++++++++++++++++++--- view/component/nav/sidenav.templ | 41 ++++++++------- 2 files changed, 94 insertions(+), 25 deletions(-) diff --git a/view/component/nav/navbarright.templ b/view/component/nav/navbarright.templ index 41110c7..1dbb11b 100644 --- a/view/component/nav/navbarright.templ +++ b/view/component/nav/navbarright.templ @@ -2,19 +2,83 @@ package nav import "projectreshoot/contexts" +type ProfileItem struct { + name string // Label to display + href string // Link reference +} + +// Return the list of profile links +func getProfileItems() []ProfileItem { + return []ProfileItem{ + { + name: "Profile", + href: "/profile", + }, + { + name: "Account", + href: "/account", + }, + } +} + // Returns the right portion of the navbar templ navRight() { {{ user := contexts.GetUser(ctx) }} + {{ items := getProfileItems() }}
if user != nil { - +
+
+ +
+ +
} else {
+ href="/register" + > + Register + + + +
+ } }