Skip to content

Commit

Permalink
Fix gtag typing and remove console log from navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-panhead committed Apr 19, 2024
1 parent 342d02d commit 1ac4c4f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"astro": "^4.6.1",
"typescript": "^5.4.5",
"vue": "^3.4.23"
},
"devDependencies": {
"@types/gtag.js": "^0.0.19"
}
}
9 changes: 8 additions & 1 deletion src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ interface Props {
}
const { title, showNav = true } = Astro.props;
declare global {
interface Window {
dataLayer: any[]
}
}
---

<!doctype html>
Expand All @@ -24,7 +30,8 @@ const { title, showNav = true } = Astro.props;
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
const gtag: Gtag.Gtag = function() {
// @ts-expect-error
dataLayer.push(arguments);
}
gtag("js", new Date());
Expand Down
2 changes: 0 additions & 2 deletions src/layouts/Navbar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import Socials from "../components/socials/Socials.astro";
const homeAnchor = document.getElementById("home");
const projectsAnchor = document.getElementById("projects");

console.log(window.location.pathname)

if (projectsAnchor && window.location.pathname.match(/^\/projects\/?$/)) {
projectsAnchor.style.fontWeight = "500";
if (homeAnchor) homeAnchor.style.fontWeight = "normal";
Expand Down

0 comments on commit 1ac4c4f

Please sign in to comment.