Skip to content

Commit a7576bd

Browse files
author
Predrag
authored
Add logic for routing in nav (#22)
1 parent 100772e commit a7576bd

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/components/common/Navigation.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ import PropTypes from "prop-types";
1616
*
1717
*/
1818

19-
const origin = typeof window !== "undefined" ? window.location.origin : "";
20-
2119
const navItems = [
22-
{ label: "Home", url: "/" },
23-
{ label: "Publications", url: `${origin}/resources/` },
20+
{ label: "Home", url: "/", internal: true },
21+
{ label: "Publications", url: `/resources/`, internal: true },
2422
{
2523
label: "In numbers",
26-
url: `${origin}/community-stats/#numbers`,
24+
url: `/community-stats/#numbers`,
25+
internal: true,
2726
},
2827
{
2928
label: "Case studies",
30-
url: `${origin}/community-stats/#case-studies`,
29+
url: `/community-stats/#case-studies`,
30+
internal: true,
3131
},
32-
{ label: "Blog", url: "https://datacebo.com/blog" },
33-
{ label: "Company", url: "https://datacebo.com" },
34-
{ label: "GitHub", url: "https://github.com/sdv-dev/SDV" },
32+
{ label: "Blog", url: "https://datacebo.com/blog", internal: false },
33+
{ label: "Company", url: "https://datacebo.com", internal: false },
34+
{ label: "GitHub", url: "https://github.com/sdv-dev/SDV", internal: false },
3535
];
3636

3737
const Navigation = ({ navClass, children, isDark }) => {
@@ -129,7 +129,7 @@ const Navigation = ({ navClass, children, isDark }) => {
129129
>
130130
<div className=" flex lg:flex-row flex-col justify-center items-center w-full">
131131
{navItems.map((navItem, i) => {
132-
if (navItem.url.match(/^\s?http(s?)/gi)) {
132+
if (!navItem.internal) {
133133
return (
134134
<a
135135
className={navClass}

src/components/common/ScarfPixel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const ScarfPixel = () => {
88
<img
99
referrerpolicy="no-referrer-when-downgrade"
1010
src="https://static.scarf.sh/a.png?x-pxid=af9a538f-69ef-4e05-8553-76897f21be21"
11+
alt="scarf"
1112
/>
1213
) : (
1314
<></>

0 commit comments

Comments
 (0)