pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/pythonpizza/warsaw.python.pizza/commit/0f3f251eb945a25f0eeb79f32e9d5200bfa20e2b

edia="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-7a1ad343bd40328c.css" /> fix(nav): restore native anchor link behavior · pythonpizza/warsaw.python.pizza@0f3f251 · GitHub
Skip to content

Commit 0f3f251

Browse files
fix(nav): restore native anchor link behavior
1 parent 557f491 commit 0f3f251

2 files changed

Lines changed: 2 additions & 22 deletions

File tree

src/components/header.tsx

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
1-
import { type MouseEvent, useCallback } from "react";
21
import { Box, Container, Flex, NavLink } from "theme-ui";
32

43
import { Logo } from "./logo";
54

65
type LinkComponent = React.FC<{ href: string; children: React.ReactNode }>;
76

87
const MenuLink: LinkComponent = ({ href, children }) => {
9-
const goToSection = useCallback(
10-
(e: MouseEvent) => {
11-
e.preventDefault();
12-
13-
const destinationEl: HTMLElement | null =
14-
window.document.querySelector(href);
15-
16-
if (!destinationEl) {
17-
return;
18-
}
19-
20-
window.scrollTo({
21-
top: destinationEl.offsetTop,
22-
behavior: "smooth",
23-
});
24-
},
25-
[href],
26-
);
27-
288
return (
299
<NavLink
3010
sx={{
@@ -39,7 +19,6 @@ const MenuLink: LinkComponent = ({ href, children }) => {
3919
}}
4020
mt={["secondary", 0]}
4121
ml={[0, "secondary"]}
42-
onClick={goToSection}
4322
href={href}
4423
>
4524
{children}
@@ -119,7 +98,7 @@ export const Header = () => (
11998
position: "absolute",
12099
top: 0,
121100
left: 0,
122-
zIndex: 1,
101+
zIndex: 10,
123102

124103
width: "100%",
125104
}}

src/pages/_app.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const App = ({ Component, pageProps }: AppProps) => (
1111
styles={css`
1212
html {
1313
font-size: 62.5%;
14+
scroll-behavior: smooth;
1415
}
1516
body {
1617
font-size: 2rem;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy