Archived
Template
1
Fork 0

Highlight support if on support page

This commit is contained in:
Korbs 2024-01-31 06:58:27 -05:00
parent 9b2963f886
commit 4b60ff664a
No known key found for this signature in database

View file

@ -14,12 +14,20 @@ import { useUserAgent } from "astro-useragent"
const uaString = Astro.request.headers.get("user-agent") const uaString = Astro.request.headers.get("user-agent")
const { source, isMobile } = useUserAgent(uaString) const { source, isMobile } = useUserAgent(uaString)
// Check if user is on Support
if (Astro.url.pathname.startsWith("/support")) {
var IsOnSupport = true
} else {
var IsOnSupport = false
}
// Properties - Selected // Properties - Selected
if (Selected === "Home") {var Select_Home = true} if (Selected === "Home") {var Select_Home = true}
else if (Selected === "Products") {var Select_Products = true} else if (Selected === "Products") {var Select_Products = true}
else if (Selected === "Pricing") {var Select_Pricing = true} else if (Selected === "Pricing") {var Select_Pricing = true}
else if (Selected === "Support") {var Select_Support = true} else if (Selected === "Support") {var Select_Support = true}
import Default from '@astrojs/starlight/components/Search.astro';
--- ---
<header> <header>
@ -36,14 +44,18 @@ else if (Selected === "Support") {var Select_Support = true}
<div class="header-center"> <div class="header-center">
<a id="menu-link-home" href="/">{t("Header.Home")}</a> <a id="menu-link-home" href="/">{t("Header.Home")}</a>
<a id="menu-link-products" href="#">{t("Header.Products")}</a> <a id="menu-link-products" href="#">{t("Header.Products")}</a>
<a id="menu-link-pricing" href="#">{t("Header.Pricing")}</a> <a id="menu-link-pricing" href="/pricing">{t("Header.Pricing")}</a>
<a id="menu-link-support" href="#">{t("Header.Support")}</a> {IsOnSupport ?
<a style="background: white; color: black;" id="menu-link-support" href="/support">{t("Header.Support")}</a>
:
<a id="menu-link-support" href="/support">{t("Header.Support")}</a>
}
</div> </div>
} }
<div class="header-end"> <div class="header-end">
<a href="#">{t("Header.Login")}</a> <a href="#">{t("Header.Login")}</a>
<a href="#">{t("Header.SignUp")}</a> <a href="#">{t("Header.SignUp")}</a>
<sl-dropdown placement="bottom-end" distance="6"> <sl-dropdown id="lang-menu" placement="bottom-end" distance="6">
<sl-button slot="trigger" caret><Language/></sl-button> <sl-button slot="trigger" caret><Language/></sl-button>
<sl-menu> <sl-menu>
<sl-menu-item onclick="location.href = '/'">English</sl-menu-item> <sl-menu-item onclick="location.href = '/'">English</sl-menu-item>