Skip to content

Commit 415d6b0

Browse files
authored
fix: scroll of Explore button to the footer (#136)
* fix: scroll of Explore button to the footer Signed-off-by: Adi-204 <adiboghawala@gmail.com> * refactor: removed explore id Signed-off-by: Adi-204 <adiboghawala@gmail.com> --------- Signed-off-by: Adi-204 <adiboghawala@gmail.com>
1 parent 75a768a commit 415d6b0

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const App = () => {
2727
const [loading, setLoading] = useState(true);
2828
const [searchParams] = useSearchParams();
2929

30-
const scrollToExplore = () => {
31-
const exploreContent = document.getElementById("explore");
30+
const scrollToFooter = () => {
31+
const exploreContent = document.getElementById("footer");
3232
if (exploreContent) {
3333
exploreContent.scrollIntoView({ behavior: "smooth" });
3434
}
@@ -102,7 +102,7 @@ const App = () => {
102102
return (
103103
<AntdApp>
104104
<Layout style={{ minHeight: "100vh" }}>
105-
<Navbar scrollToExplore={scrollToExplore} />
105+
<Navbar scrollToFooter={scrollToFooter} />
106106
<Content>
107107
<Routes>
108108
<Route
@@ -116,7 +116,7 @@ const App = () => {
116116
background: backgroundColor,
117117
}}
118118
>
119-
<Row id="explore">
119+
<Row>
120120
<Col xs={24} sm={8}>
121121
<Row
122122
style={{

src/components/Footer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const CustomFooter: React.FC = () => {
2222

2323
return (
2424
<Footer
25+
id="footer"
2526
style={{
2627
background: "#1b2540",
2728
color: "white",

src/components/Navbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import ToggleDarkMode from "./ToggleDarkMode";
1414

1515
const { useBreakpoint } = Grid;
1616

17-
function Navbar({ scrollToExplore }: { scrollToExplore: any }) {
17+
function Navbar({ scrollToFooter }: { scrollToFooter: any }) {
1818
const [hovered, setHovered] = useState<
1919
null | "home" | "explore" | "help" | "github" | "join"
2020
>(null);
@@ -143,7 +143,7 @@ function Navbar({ scrollToExplore }: { scrollToExplore: any }) {
143143
...menuItemStyle("explore", false),
144144
cursor: "pointer",
145145
}}
146-
onClick={scrollToExplore}
146+
onClick={scrollToFooter}
147147
onMouseEnter={() => setHovered("explore")}
148148
onMouseLeave={() => setHovered(null)}
149149
>

src/tests/components/Navbar.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ vi.mock("../../components/ToggleDarkMode", () => ({
1111
const renderNavbar = () => {
1212
render(
1313
<MemoryRouter>
14-
<Navbar scrollToExplore={() => {}} />
14+
<Navbar scrollToFooter={() => {}} />
1515
</MemoryRouter>
1616
);
1717
};

0 commit comments

Comments
 (0)