navbar algin

This commit is contained in:
2026-07-08 19:29:42 +05:30
parent d639415d89
commit 0fc09a934c
2 changed files with 117 additions and 79 deletions

View File

@@ -184,7 +184,11 @@ body {
}
#masthead .elementor-element.elementor-element-466de1b.dm-header-scrolled {
top: 0 !important;
top: 15px !important;
left: 20px !important;
right: 20px !important;
border-radius: 24px !important;
width: auto !important;
}
}

View File

@@ -30,11 +30,13 @@ const CURRENT_PAGE_ALIASES: Record<string, string[]> = {
home: ["home"],
"how-it-works": ["how-it-works", "how-its-works"],
miletruth: ["miletruth"],
// Solutions is a normal nav page and also owns the Wings/Express dropdown.
solutions: ["solutions", "doormile-wings", "express"],
// Solutions is now a plain top-level link — no child pages own its active state.
solutions: ["solutions"],
"doormile-wings": ["doormile-wings"],
about: ["about", "about-us", "women"],
blogs: ["blogs"],
// Company is the dropdown parent for Blogs + How It Works — active if either is.
company: ["blogs", "how-it-works"],
};
export default function Header() {
@@ -82,20 +84,20 @@ export default function Header() {
const [visibleScrolled, setVisibleScrolled] = useState(false);
const [isScrolled, setIsScrolled] = useState(false);
// Solutions dropdown (desktop) / accordion (mobile). Local to Header —
// Company dropdown (desktop) / accordion (mobile). Local to Header —
// unlike isMenuOpen/isSidebarOpen (HeaderUIProvider), no sibling component
// needs to read this.
const [isDesktopSolutionsOpen, setDesktopSolutionsOpen] = useState(false);
const [isMobileSolutionsOpen, setMobileSolutionsOpen] = useState(false);
const [isDesktopCompanyOpen, setDesktopCompanyOpen] = useState(false);
const [isMobileCompanyOpen, setMobileCompanyOpen] = useState(false);
// Collapse the accordion whenever the off-canvas menu closes, so it isn't
// left expanded the next time the menu opens.
const closeMobileMenu = () => {
setMobileSolutionsOpen(false);
setMobileCompanyOpen(false);
closeAll();
};
const toggleMobileMenu = () => {
setMobileSolutionsOpen(false);
setMobileCompanyOpen(false);
toggleMenu();
};
@@ -457,56 +459,70 @@ export default function Header() {
<li id="menu-item-10508" className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10508${dmHeaderActive("home")}`}>
<Link href="/#home" onClick={(event) => handleNavClick(event, "/", "home")}>Home</Link>
</li>
<li id="menu-item-10509" className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10509${dmHeaderActive("how-it-works")}`}>
<Link href="/how-it-works#how-it-works" onClick={(event) => handleNavClick(event, "/how-it-works", "how-it-works")}>How It Works</Link>
<li id="menu-item-10509" className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10509${dmHeaderActive("doormile-wings")}`}>
<Link href="/doormile-wings" prefetch>Doormile Wings</Link>
</li>
<li id="menu-item-10510" className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10510${dmHeaderActive("miletruth")}`}>
<Link href="/miletruth#miletruth" onClick={(event) => handleNavClick(event, "/miletruth", "miletruth")}>MileTruth&trade; AI</Link>
</li>
<li
id="menu-item-10511"
className={`menu-item menu-item-type-custom menu-item-has-children menu-item-10511${dmHeaderActive("solutions")}`}
onMouseEnter={() => setDesktopSolutionsOpen(true)}
onMouseLeave={() => setDesktopSolutionsOpen(false)}
onKeyDown={(event: KeyboardEvent<HTMLLIElement>) => {
if (event.key !== "Escape") return;
setDesktopSolutionsOpen(false);
event.currentTarget.querySelector<HTMLAnchorElement>(":scope > a")?.focus();
}}
onBlur={(event: FocusEvent<HTMLLIElement>) => {
if (!event.currentTarget.contains(event.relatedTarget as Node)) {
setDesktopSolutionsOpen(false);
}
}}
>
<Link
href="/solutions"
prefetch
aria-haspopup="true"
aria-expanded={isDesktopSolutionsOpen}
onFocus={() => setDesktopSolutionsOpen(true)}
onClick={() => setDesktopSolutionsOpen(false)}
>
Solutions
</Link>
<ul className="dm-solutions-dropdown">
<li className={currentPage === "doormile-wings" ? "dm-child-active" : ""}>
<Link href="/doormile-wings" prefetch onClick={() => setDesktopSolutionsOpen(false)}>
Doormile Wings
</Link>
</li>
<li className={currentPage === "express" ? "dm-child-active" : ""}>
<Link href="/express" prefetch onClick={() => setDesktopSolutionsOpen(false)}>
Express
</Link>
</li>
</ul>
<li id="menu-item-10511" className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10511${dmHeaderActive("solutions")}`}>
<Link href="/solutions" prefetch>Solutions</Link>
</li>
<li id="menu-item-10512" className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10512${dmHeaderActive("about")}`}>
<Link href="/about-us#about" onClick={(event) => handleNavClick(event, "/about-us", "about")}>About</Link>
</li>
<li id="menu-item-10535" className={`menu-item menu-item-type-post_type menu-item-object-page menu-item-10535${dmHeaderActive("blogs")}`}>
<Link href="/blog#blogs" onClick={(event) => handleNavClick(event, "/blog", "blogs")}>Blogs</Link>
<li
id="menu-item-10535"
className={`menu-item menu-item-type-custom menu-item-has-children menu-item-10535${dmHeaderActive("company")}`}
onMouseEnter={() => setDesktopCompanyOpen(true)}
onMouseLeave={() => setDesktopCompanyOpen(false)}
onKeyDown={(event: KeyboardEvent<HTMLLIElement>) => {
if (event.key !== "Escape") return;
setDesktopCompanyOpen(false);
event.currentTarget.querySelector<HTMLAnchorElement>(":scope > a")?.focus();
}}
onBlur={(event: FocusEvent<HTMLLIElement>) => {
if (!event.currentTarget.contains(event.relatedTarget as Node)) {
setDesktopCompanyOpen(false);
}
}}
>
<a
href="#"
aria-haspopup="true"
aria-expanded={isDesktopCompanyOpen}
onFocus={() => setDesktopCompanyOpen(true)}
onClick={(event) => {
event.preventDefault();
setDesktopCompanyOpen((open) => !open);
}}
>
Company
</a>
<ul className="dm-solutions-dropdown">
<li className={currentPage === "blogs" ? "dm-child-active" : ""}>
<Link
href="/blog#blogs"
onClick={(event) => {
setDesktopCompanyOpen(false);
handleNavClick(event, "/blog", "blogs");
}}
>
Blogs
</Link>
</li>
<li className={currentPage === "how-it-works" ? "dm-child-active" : ""}>
<Link
href="/how-it-works#how-it-works"
onClick={(event) => {
setDesktopCompanyOpen(false);
handleNavClick(event, "/how-it-works", "how-it-works");
}}
>
How It Works
</Link>
</li>
</ul>
</li>
</ul>
</nav>
@@ -541,45 +557,51 @@ export default function Header() {
<li className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10508${dmHeaderActive("home")}`}>
<Link href="/#home" onClick={(event) => handleNavClick(event, "/", "home", true)}>Home</Link>
</li>
<li className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10509${dmHeaderActive("how-it-works")}`}>
<Link href="/how-it-works#how-it-works" onClick={(event) => handleNavClick(event, "/how-it-works", "how-it-works", true)}>How It Works</Link>
<li className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10509${dmHeaderActive("doormile-wings")}`}>
<Link href="/doormile-wings" prefetch onClick={closeMobileMenu}>Doormile Wings</Link>
</li>
<li className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10510${dmHeaderActive("miletruth")}`}>
<Link href="/miletruth#miletruth" onClick={(event) => handleNavClick(event, "/miletruth", "miletruth", true)}>MileTruth&trade; AI</Link>
</li>
<li className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-10511${dmHeaderActive("solutions")}`}>
<Link href="/solutions" prefetch onClick={closeMobileMenu}>Solutions</Link>
</li>
<li className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-10512${dmHeaderActive("about")}`}>
<Link href="/about-us#about" onClick={(event) => handleNavClick(event, "/about-us", "about", true)}>About</Link>
</li>
<li
className={`menu-item menu-item-type-custom menu-item-10511 dm-mobile-solutions${dmHeaderActive("solutions")}${isMobileSolutionsOpen ? " dm-accordion-open" : ""}`}
className={`menu-item menu-item-type-custom menu-item-10535 dm-mobile-solutions${dmHeaderActive("company")}${isMobileCompanyOpen ? " dm-accordion-open" : ""}`}
>
<div className="dm-mobile-solutions-row">
<Link href="/solutions" prefetch onClick={closeMobileMenu}>
Solutions
</Link>
<a
href="#"
onClick={(event) => {
event.preventDefault();
setMobileCompanyOpen((open) => !open);
}}
>
Company
</a>
<button
type="button"
className="dm-mobile-solutions-toggle"
aria-label={isMobileSolutionsOpen ? "Close Solutions menu" : "Open Solutions menu"}
aria-label={isMobileCompanyOpen ? "Close Company menu" : "Open Company menu"}
aria-haspopup="true"
aria-expanded={isMobileSolutionsOpen}
onClick={() => setMobileSolutionsOpen((open) => !open)}
aria-expanded={isMobileCompanyOpen}
onClick={() => setMobileCompanyOpen((open) => !open)}
>
<span className="dm-accordion-chevron" aria-hidden="true"></span>
</button>
</div>
<ul className="dm-mobile-solutions-panel">
<li className={currentPage === "doormile-wings" ? "dm-child-active" : ""}>
<Link href="/doormile-wings" prefetch onClick={closeMobileMenu}>Doormile Wings</Link>
<li className={currentPage === "blogs" ? "dm-child-active" : ""}>
<Link href="/blog#blogs" onClick={(event) => handleNavClick(event, "/blog", "blogs", true)}>Blogs</Link>
</li>
<li className={currentPage === "express" ? "dm-child-active" : ""}>
<Link href="/express" prefetch onClick={closeMobileMenu}>Express</Link>
<li className={currentPage === "how-it-works" ? "dm-child-active" : ""}>
<Link href="/how-it-works#how-it-works" onClick={(event) => handleNavClick(event, "/how-it-works", "how-it-works", true)}>How It Works</Link>
</li>
</ul>
</li>
<li className={`menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-10512${dmHeaderActive("about")}`}>
<Link href="/about-us#about" onClick={(event) => handleNavClick(event, "/about-us", "about", true)}>About</Link>
</li>
<li className={`menu-item menu-item-type-post_type menu-item-object-page menu-item-10535${dmHeaderActive("blogs")}`}>
<Link href="/blog#blogs" onClick={(event) => handleNavClick(event, "/blog", "blogs", true)}>Blogs</Link>
</li>
</ul>
</nav>
<div className="header-mobile-contacts">
@@ -768,7 +790,10 @@ export default function Header() {
-webkit-backdrop-filter: blur(14px) !important;
backdrop-filter: blur(14px) !important;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22) !important;
top: 0 !important;
top: 15px !important;
left: 20px !important;
right: 20px !important;
border-radius: 24px !important;
}
#masthead .elementor-element.elementor-element-466de1b.dm-header-scrolled .elementor-element.elementor-element-e052838 {
@@ -899,9 +924,15 @@ export default function Header() {
to the top once scrolled past 50px, matching desktop behaviour. */
#masthead .elementor-element.elementor-element-466de1b.dm-header-scrolled {
position: fixed !important;
top: 18px !important;
left: 0 !important;
right: 0 !important;
background: rgba(26, 26, 26, 0.92) !important;
-webkit-backdrop-filter: blur(14px) !important;
backdrop-filter: blur(14px) !important;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22) !important;
top: 15px !important;
left: 20px !important;
right: 20px !important;
border-radius: 20px !important;
width: auto !important;
}
#masthead .elementor-element.elementor-element-e052838 {
@@ -959,12 +990,15 @@ export default function Header() {
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='5' y1='5' x2='19' y2='19'/%3E%3Cline x1='19' y1='5' x2='5' y2='19'/%3E%3C/svg%3E");
}
/* ── Solutions dropdown (desktop) / accordion (mobile) ──
Solutions remains linked to /solutions while the nested menu opens
independently. It reuses site.css's dead .menu-item-has-children chevron (fontello
glyph, already coloured white for this exact header widget) instead
of inventing a new arrow, so it matches the site's existing premium
nav styling. Desktop opens on hover/focus; mobile is a
/* ── Company dropdown (desktop) / accordion (mobile) ──
Company (Blogs + How It Works) is a non-navigating parent —
its trigger is a plain anchor with no href target, only a
dropdown toggle. Class names below (.dm-solutions-dropdown,
.dm-mobile-solutions*) are unchanged from when this same
component/markup belonged to Solutions, reusing site.css's dead
.menu-item-has-children chevron (fontello glyph, already
coloured white for this exact header widget) instead of
inventing a new arrow. Desktop opens on hover/focus; mobile is a
height-collapsing accordion controlled by the chevron button. */
@media (min-width: 1025px) {
#masthead .header-menu-container nav {