Skip to content

Commit 261038a

Browse files
authored
Merge pull request #244 from ahmed0saber/open-external-links-in-new-tab
Open external links in new tab
2 parents 8b95b76 + 81596fc commit 261038a

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

components/footer/index.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,21 @@ export default function Footer() {
3838
<Link href="/#donate">{t("donateTitle")}</Link>
3939
</div>
4040
<div className={classes.list}>
41-
<Link href="https://github.com/TheAlgorithms/">GitHub</Link>
42-
<Link href="https://matrix.to/#/#TheAlgorithms_community:gitter.im">
41+
<a href="https://github.com/TheAlgorithms/" target="_blank" rel="noreferrer">GitHub</a>
42+
<a href="https://matrix.to/#/#TheAlgorithms_community:gitter.im" target="_blank" rel="noreferrer">
4343
Gitter
44-
</Link>
45-
<Link href="https://twitter.com/The_Algorithms">Twitter</Link>
46-
<Link href="https://github.com/TheAlgorithms/website">
44+
</a>
45+
<a href="https://twitter.com/The_Algorithms" target="_blank" rel="noreferrer">Twitter</a>
46+
<a href="https://github.com/TheAlgorithms/website" target="_blank" rel="noreferrer">
4747
{t("sourceCodeFooter")}
48-
</Link>
49-
<Link href="mailto:[email protected]">{t("contact")}</Link>
48+
</a>
49+
<a href="mailto:[email protected]" target="_blank" rel="noreferrer">{t("contact")}</a>
5050
</div>
5151
<a
5252
className={classes.vercelLogo}
5353
href="https://vercel.com?utm_source=thealgorithms&utm_campaign=oss"
54+
target="_blank"
55+
rel="noreferrer"
5456
>
5557
<img src="/powered-by-vercel-t.svg" alt="Powered by Vercel" />
5658
</a>

components/footer/style.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
margin-right: 30px;
2020
}
2121

22+
.list a {
23+
text-decoration: none;
24+
}
25+
2226
.grid {
2327
display: grid;
2428
grid-template-rows: 35px auto;

components/navbar/index.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ export default function Navbar({
5353
{
5454
name: t("aboutTextNavbar"),
5555
href: "/#aboutUs",
56+
target: "_self",
5657
},
5758
{
5859
name: t("donateButton"),
5960
href: "https://liberapay.com/TheAlgorithms/donate",
61+
target: "_blank",
6062
},
6163
];
6264

@@ -131,9 +133,7 @@ export default function Navbar({
131133
<GithubOriginalIcon color="white" />
132134
</IconButton>
133135
{menu.map((item) => (
134-
<NextLink passHref key={item.name} href={item.href}>
135-
<Button>{item.name}</Button>
136-
</NextLink>
136+
<Button key={item.name} href={item.href} target={item.target}>{item.name}</Button>
137137
))}
138138
</div>
139139
)}
@@ -151,13 +151,15 @@ export default function Navbar({
151151
<SearchBar query={query} setQuery={setQuery} small />
152152
</ListItem>
153153
{menu.map((item) => (
154-
<NextLink key={item.name} href={item.href}>
155-
<MenuItem>{item.name}</MenuItem>
156-
</NextLink>
154+
<MenuItem key={item.name}>
155+
<Button href={item.href} target={item.target} className={classes.sidebarLink}>
156+
{item.name}
157+
</Button>
158+
</MenuItem>
157159
))}
158-
<NextLink href="https://github.com/TheAlgorithms">
159-
<MenuItem>GitHub</MenuItem>
160-
</NextLink>
160+
<MenuItem>
161+
<a className={classes.unstyledLink} href="https://github.com/TheAlgorithms" target="_blank" rel="noreferrer">GitHub</a>
162+
</MenuItem>
161163
<MenuItem onClick={() => switchTheme()}>
162164
{darkTheme ? t("lightModeNavbar") : t("darkModeNavbar")}
163165
</MenuItem>

components/navbar/style.module.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,13 @@
6464
width: 1em;
6565
height: 1em;
6666
}
67+
68+
.sidebarLink {
69+
padding: 0px !important;
70+
min-width: auto !important;
71+
}
72+
73+
.unstyledLink {
74+
color: #fff;
75+
text-decoration: none;
76+
}

0 commit comments

Comments
 (0)