Skip to content

Commit ef8e694

Browse files
authored
Merge pull request #63 from UW-Macrostrat/scroll
Page change scroll
2 parents 1a148df + 9f0c90b commit ef8e694

File tree

3 files changed

+35
-77
lines changed

3 files changed

+35
-77
lines changed

pages/+Page.client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { Image, Footer } from "~/components/general";
22
import "@macrostrat/style-system";
33
import h from "./main.module.sass";
44
import "@macrostrat/style-system";
5+
import { useEffect } from "react";
56

67
export function Page() {
7-
return h("div", { className: "main-page" }, [
8+
return h("div", { className: "main-page"}, [
89
h("div", { className: "new_container field" }, [
910
h("div", { className: "mask" }, [
1011
h(Image, { src: "main-page/field.jpg", className: "start-img back-img", alt: "Field" }),

src/components/general/index.ts

Lines changed: 31 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@ import mapboxgl from "mapbox-gl";
1010
import { SETTINGS } from "@macrostrat-web/settings";
1111
import { rockdApiURL, rockdApiOldURL } from "@macrostrat-web/settings";
1212
import { useState } from "react";
13+
import { navigate } from "vike/client/router";
1314

1415
export function Footer() {
15-
const isDarkMode = useDarkMode().isEnabled;
16+
const footerLinks1 = [
17+
{ href: "/", icon: "home", text: "Home" },
18+
{ href: "/explore", icon: "geosearch", text: "Explore" },
19+
{ href: "/trip/1", icon: "route", text: "Trip" },
20+
];
21+
22+
const footerLinks2 = [
23+
{ href: "/metrics", icon: "chart", text: "Metrics" },
24+
{ href: "/terms", icon: "manual", text: "Terms and Conditions" },
25+
{ href: "/privacy", icon: "lock", text: "Privacy" },
26+
];
1627

1728
return h("div", { className: "footer" }, [
1829
h("div", { className: "titles" }, [
@@ -32,83 +43,32 @@ export function Footer() {
3243
]),
3344
]),
3445
h("div", { className: "footer-links" }, [
35-
h("ul", [
36-
h(
37-
"li",
38-
h("a", { href: "/" }, [
39-
h(Icon, {
40-
className: "footer-icon" + (isDarkMode ? "icon-dark-mode" : ""),
41-
icon: "home",
42-
style: { color: "white" },
43-
}),
44-
h("p", "Home"),
45-
])
46-
),
47-
h(
48-
"li",
49-
h("a", { href: "/explore" }, [
50-
h(Icon, {
51-
className: "footer-icon" + (isDarkMode ? "icon-dark-mode" : ""),
52-
icon: "geosearch",
53-
style: { color: "white" },
54-
}),
55-
h("p", "Explore"),
56-
])
57-
),
58-
h(
59-
"li",
60-
h("a", { href: "/trip/1" }, [
61-
h(Icon, {
62-
className: "footer-icon" + (isDarkMode ? "icon-dark-mode" : ""),
63-
icon: "route",
64-
style: { color: "white" },
65-
}),
66-
h("p", "Trip"),
67-
])
68-
),
69-
]),
70-
h("ul", [
71-
h(
72-
"li",
73-
h("a", { href: "/metrics" }, [
74-
h(Icon, {
75-
className: "footer-icon" + (isDarkMode ? "icon-dark-mode" : ""),
76-
icon: "chart",
77-
style: { color: "white" },
78-
}),
79-
h("p", "Metrics"),
80-
])
81-
),
82-
h(
83-
"li",
84-
h("a", { href: "/terms" }, [
85-
h(Icon, {
86-
className: "footer-icon" + (isDarkMode ? "icon-dark-mode" : ""),
87-
icon: "manual",
88-
style: { color: "white" },
89-
}),
90-
h("p", "Terms and Conditions"),
91-
])
92-
),
93-
h(
94-
"li",
95-
h("a", { href: "/privacy" }, [
96-
h(Icon, {
97-
className: "footer-icon" + (isDarkMode ? "icon-dark-mode" : ""),
98-
icon: "lock",
99-
style: { color: "white" },
100-
}),
101-
h("p", "Privacy"),
102-
])
103-
),
104-
]),
46+
h("ul", footerLinks1.map((props) => h(FooterLink, props))),
47+
h("ul", footerLinks2.map((props) => h(FooterLink, props))),
10548
]),
10649
h("div.dark-mode", [
10750
h(DarkModeButton, { className: "dark-mode-button", showText: true }),
10851
]),
10952
]);
11053
}
11154

55+
function FooterLink({ href, icon, text }) {
56+
const isDarkMode = useDarkMode().isEnabled;
57+
58+
return h("li", { onClick: (e) => {
59+
e.preventDefault();
60+
window.open(href, "_self");
61+
}}, [
62+
h(Icon, {
63+
className: "footer-icon",
64+
icon,
65+
style: { color: isDarkMode ? "black" : "white" },
66+
}),
67+
h("p", text),
68+
]);
69+
}
70+
71+
11272
export function Image(props: ImageProps) {
11373
const { src, className, width, height, onClick, alt } = props
11474
const [hasError, setHasError] = useState(false);

src/components/general/layout.module.sass

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,10 @@
6565
.footer-icon
6666
filter: var(--anti-img-color)
6767

68-
a
69-
color: var(--panel-text)
68+
li
7069
display: flex
7170
gap: 5px
72-
73-
&:hover
74-
color: var(--panel-text)
71+
cursor: pointer
7572

7673
.row
7774
width: 100%

0 commit comments

Comments
 (0)