#include "NavigationBar.h" #include constexpr auto Burger = R"( )"; constexpr auto Menu = R"(
Home
)"; constexpr auto Template = R"(
子非鱼 ${navbar-burger role="button" class="bulma-navbar-burger" aria-label="menu" aria-expanded="false"}
${navbar-menu class="bulma-navbar-menu"} )"; constexpr auto JS = R"( function(o) {{ {}.classList.toggle('bulma-is-active'); {}.classList.toggle('bulma-is-active'); }} )"; NavigationBar::NavigationBar() : Wt::WTemplate(Template) { setHtmlTagName("nav"); setStyleClass("bulma-navbar"); setAttributeValue("role", "navigation"); setAttributeValue("aria-label", "main navigation"); auto navbarBurger = bindWidget("navbar-burger", std::make_unique(Burger)); navbarBurger->setHtmlTagName("a"); auto navbarMenu = bindWidget("navbar-menu", std::make_unique(Menu)); navbarBurger->clicked().connect(std::format(JS, navbarBurger->id(), navbarMenu->id())); }