feat: breadcrumbs
This commit is contained in:
parent
2a9c2ca263
commit
88c8596512
11 changed files with 140 additions and 20 deletions
|
|
@ -15,6 +15,12 @@ import (
|
|||
)
|
||||
|
||||
templ App(title string, sidebarContent ...templ.Component) {
|
||||
@AppWithBreadcrumb(title, defaultBreadcrumb(title), sidebarContent...) {
|
||||
{ children... }
|
||||
}
|
||||
}
|
||||
|
||||
templ AppWithBreadcrumb(title string, breadcrumbContent templ.Component, sidebarContent ...templ.Component) {
|
||||
{{ cfg := ctxkeys.Config(ctx) }}
|
||||
@Base(SEOProps{
|
||||
Title: title,
|
||||
|
|
@ -80,15 +86,7 @@ templ App(title string, sidebarContent ...templ.Component) {
|
|||
<div class="flex h-14 items-center px-6">
|
||||
<div class="flex items-center gap-4">
|
||||
@sidebar.Trigger()
|
||||
@breadcrumb.Breadcrumb() {
|
||||
@breadcrumb.List() {
|
||||
@breadcrumb.Item() {
|
||||
@breadcrumb.Page() {
|
||||
{ title }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@breadcrumbContent
|
||||
</div>
|
||||
<div class="ml-auto flex items-center gap-4">
|
||||
{{ user := ctxkeys.User(ctx) }}
|
||||
|
|
@ -107,6 +105,18 @@ templ App(title string, sidebarContent ...templ.Component) {
|
|||
}
|
||||
}
|
||||
|
||||
templ defaultBreadcrumb(title string) {
|
||||
@breadcrumb.Breadcrumb() {
|
||||
@breadcrumb.List() {
|
||||
@breadcrumb.Item() {
|
||||
@breadcrumb.Page() {
|
||||
{ title }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ AppAccountDropdown(user *model.User) {
|
||||
{{ displayName := user.Email }}
|
||||
{{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue