feat: Initial navbar
This commit is contained in:
49
Sources/ViewController/Views/Navbar.swift
Normal file
49
Sources/ViewController/Views/Navbar.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
import Elementary
|
||||
import ManualDCore
|
||||
import Styleguide
|
||||
|
||||
struct Navbar: HTML, Sendable {
|
||||
let sidebarToggle: Bool
|
||||
|
||||
var body: some HTML<HTMLTag.nav> {
|
||||
nav(.class("navbar w-full bg-base-300 text-base-content shadow-sm mb-4")) {
|
||||
div(.class("flex-1 space-x-4 items-center")) {
|
||||
if sidebarToggle {
|
||||
Tooltip("Open sidebar", position: .right) {
|
||||
label(
|
||||
.for("my-drawer-1"),
|
||||
.class("size-7"),
|
||||
.init(name: "aria-label", value: "open sidebar")
|
||||
) {
|
||||
SVG(.sidebarToggle)
|
||||
}
|
||||
.navButton()
|
||||
}
|
||||
}
|
||||
Tooltip("Home", position: .right) {
|
||||
a(
|
||||
.class("w-fit text-xl py-2 px-4"),
|
||||
.href(route: .project(.index))
|
||||
) {
|
||||
"Manual-D"
|
||||
}
|
||||
.navButton()
|
||||
}
|
||||
}
|
||||
div(.class("flex-none")) {
|
||||
button(.class("w-fit px-4 py-2")) {
|
||||
"User Menu"
|
||||
}
|
||||
.navButton()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension HTML where Tag: HTMLTrait.Attributes.Global {
|
||||
func navButton() -> _AttributedElement<Self> {
|
||||
attributes(
|
||||
.class("btn btn-square btn-ghost hover:bg-neutral hover:text-white")
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user