Skip to content

Commit f1f2eab

Browse files
committed
nw resolver and fixed bugs
1 parent 730bb6f commit f1f2eab

8 files changed

+58
-52
lines changed

src/components/Buttons/bottom/ScrollToBottomButton.module.css

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.scrollToBottomButton {
2+
position: fixed;
3+
bottom: 20px;
4+
right: 20px;
5+
background-color: #28a745;
6+
color: white;
7+
border: none;
8+
border-radius: 8px;
9+
padding: 10px;
10+
cursor: pointer;
11+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
12+
transition: opacity 0.3s;
13+
opacity: 0.8;
14+
z-index: 1000;
15+
}
16+
17+
.scrollToBottomButton:hover {
18+
background-color: #218838;
19+
opacity: 1;
20+
}

src/components/Buttons/bottom/ScrollToBottomButton.jsx renamed to src/components/Buttons/bottom/ScrollTopToButton.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import React, { useEffect, useState } from "react";
22
import { FaArrowDown } from "react-icons/fa";
3-
import styles from "./ScrollToBottomButton.module.css";
3+
import styles from "./ScrollTopToBottom.module.css";
44

5-
export default function ScrollToBottomButton() {
6-
const [showButton, setShowButton] = useState(true);
5+
export default function ScrollTopToBottom() {
6+
const [showButton, setShowButton] = useState(false);
77

88
const scrollToBottom = () => {
99
window.scrollTo({
1010
top: document.documentElement.scrollHeight,
1111
behavior: "smooth",
1212
});
13-
setShowButton(false);
1413
};
1514

1615
const handleScroll = () => {
17-
if (window.scrollY === 0) {
16+
const bottomThreshold = document.documentElement.scrollHeight - window.innerHeight - 100;
17+
if (window.scrollY < bottomThreshold) {
1818
setShowButton(true);
19+
} else {
20+
setShowButton(false);
1921
}
2022
};
2123

@@ -33,4 +35,4 @@ export default function ScrollToBottomButton() {
3335
</button>
3436
)
3537
);
36-
}
38+
}

src/components/Buttons/top/ScrollToTopButton.jsx renamed to src/components/Buttons/top/ScrollBottomToTop.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { useEffect, useState } from "react";
22
import { FaArrowUp } from "react-icons/fa";
3-
import styles from "./ScrollToTopButton.module.css";
3+
import styles from "./ScrollBottomToTop.module.css";
44

5-
export default function ScrollToTopButton() {
5+
export default function ScrollBottomToTop() {
66
const [showButton, setShowButton] = useState(false);
77

88
const scrollToTop = () => {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.scrollToTopButton {
2+
position: fixed;
3+
bottom: 80px;
4+
right: 20px;
5+
background-color: #007bff;
6+
color: white;
7+
border: none;
8+
border-radius: 8px;
9+
padding: 10px;
10+
cursor: pointer;
11+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
12+
transition: opacity 0.3s;
13+
opacity: 0.8;
14+
z-index: 1000;
15+
}
16+
17+
.scrollToTopButton:hover {
18+
background-color: #0056b3;
19+
opacity: 1;
20+
}

src/components/Buttons/top/ScrollToTopButton.module.css

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/components/HomePage/ResourcesSection.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface Resource {
1818

1919
const ALL_RESOURCES: Resource[] = [
2020
{
21-
url: "https://www.codeharborhub.live/docs/",
21+
url: "https://codeharborhub.github.io/docs/",
2222
type: "tutorial",
2323
title: "Tutorial: For Beginners",
2424
description:
@@ -27,7 +27,7 @@ const ALL_RESOURCES: Resource[] = [
2727
duration: "10 min",
2828
},
2929
{
30-
url: "https://www.codeharborhub.live/courses/",
30+
url: "https://codeharborhub.github.io/courses/",
3131
type: "courses",
3232
title: "Courses: For Advanced Users",
3333
description:
@@ -36,7 +36,7 @@ const ALL_RESOURCES: Resource[] = [
3636
duration: "3 min",
3737
},
3838
{
39-
url: "https://www.codeharborhub.live/blog/",
39+
url: "https://codeharborhub.github.io/blog/",
4040
type: "blog",
4141
title: "Blog: For All Users",
4242
description:
@@ -45,7 +45,7 @@ const ALL_RESOURCES: Resource[] = [
4545
duration: "7 min",
4646
},
4747
{
48-
url: "https://www.codeharborhub.live/dsa/",
48+
url: "https://codeharborhub.github.io/dsa/",
4949
type: "dsa",
5050
title: "DSA: For Competitive Programmers",
5151
description:

src/pages/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import Tweet from "../components/Tweet";
1212
import Tweets, { type TweetItem } from "../data/tweets";
1313
import { motion } from "framer-motion";
1414
import ResourcesSection from "../components/HomePage/ResourcesSection";
15-
import ScrollToTopButton from "../components/Buttons/bottom/ScrollToBottomButton";
16-
import ScrollToBottomButton from "../components/Buttons/top/ScrollToTopButton";
15+
import ScrollTopToButton from "../components/Buttons/bottom/ScrollTopToButton";
16+
import ScrollBottomToTop from "../components/Buttons/top/ScrollBottomToTop";
1717

1818
function TweetsSection() {
1919
const tweetColumns = [[], [], []];
@@ -145,8 +145,8 @@ export default function Home() {
145145

146146
<TweetsSection />
147147

148-
<ScrollToTopButton />
149-
<ScrollToBottomButton />
148+
<ScrollTopToButton />
149+
<ScrollBottomToTop />
150150
</main>
151151
</Layout>
152152
);

0 commit comments

Comments
 (0)