diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx
index 1f08cf48..54d6fde1 100644
--- a/src/components/Layout.tsx
+++ b/src/components/Layout.tsx
@@ -4,6 +4,8 @@ import React from "react";
import { Lato } from "@next/font/google";
import { Footer } from "./Footer";
import { Navbar } from "./Navbar";
+import { motion } from "framer-motion";
+import { ScrollToTop } from "./ScrollToTop";
const lato = Lato({
subsets: ["latin"],
@@ -14,12 +16,21 @@ const lato = Lato({
export const Layout = ({ children }: { children: ReactNode }) => {
return (
-
-
-
- {children}
-
-
-
+
+
+
+
+ {children}
+
+
+
+
+
);
};
diff --git a/src/components/ScrollToTop.tsx b/src/components/ScrollToTop.tsx
new file mode 100644
index 00000000..6c240a49
--- /dev/null
+++ b/src/components/ScrollToTop.tsx
@@ -0,0 +1,45 @@
+import { ArrowUpIcon } from "@chakra-ui/icons";
+import { Box, IconButton } from "@chakra-ui/react";
+import { motion } from "framer-motion";
+import React, { useEffect, useState } from "react";
+import { AnimatePresenceSSR } from "./AnimatePresenceSSR";
+
+export const ScrollToTop = () => {
+ const [scrollPosition, setScrollPosition] = useState(0);
+ const handleScroll = () => {
+ const position = window.pageYOffset;
+ setScrollPosition(position);
+ };
+
+ useEffect(() => {
+ window.addEventListener("scroll", handleScroll, { passive: true });
+
+ return () => {
+ window.removeEventListener("scroll", handleScroll);
+ };
+ }, []);
+ return (
+
+ {scrollPosition > 500 ? (
+
+
+ {
+ window.scrollTo({ top: 0, behavior: "smooth" });
+ }}
+ colorScheme="blue"
+ aria-label="Wróć do góry"
+ size="lg"
+ icon={}
+ />
+
+
+ ) : null}
+
+ );
+};