Skip to content

Commit ff606fe

Browse files
committed
navigation is now in a good state; transitioning to managing displayed content
1 parent d5cbd99 commit ff606fe

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

src/components/HomeView.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ const HomeView = ({}: Props) => {
2020
const param3_Opts = ["gamedev", "webdev"];
2121
const param4_Opts = AppConfig.projectURL_Params;
2222
// useStates for Interfacing with URL Params
23-
const [param1, setParam1] = useState<string>("home");
24-
const [param2, setParam2] = useState<string>("portfolio");
25-
const [param3, setParam3] = useState<string>("gamedev");
26-
const [param4, setParam4] = useState<string>("deerfall");
23+
const [param1, setParam1] = useState<string>("");
24+
const [param2, setParam2] = useState<string>("");
25+
const [param3, setParam3] = useState<string>("");
26+
const [param4, setParam4] = useState<string>("");
2727
const [allParamsObj, setAllParamsObj] = useState<any>({
2828
param1,
2929
param2,
@@ -97,6 +97,7 @@ const HomeView = ({}: Props) => {
9797
subEmoji={subEmoji}
9898
currentContent={currentContent}
9999
allParamsObj={allParamsObj}
100+
isLanding={isLanding}
100101
/>
101102
<Outlet />
102103
<HomeViewFooter currentContent={"deerfall"} allParamsObj={allParamsObj} />

src/components/HomeViewHeader.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useContext, useEffect, useState } from "react";
1+
import { useContext, useEffect, useReducer, useState } from "react";
22
import { Link, NavLink } from "react-router-dom";
33
import { animated } from "react-spring";
44
import AppContext from "../contexts/AppContext";
@@ -8,6 +8,7 @@ interface Props {
88
subtitle: string;
99
subEmoji: string;
1010
currentContent: string;
11+
isLanding: boolean;
1112
allParamsObj: {
1213
param1: string;
1314
param2: string;
@@ -20,11 +21,13 @@ const HomeViewHeader = ({
2021
subtitle,
2122
subEmoji,
2223
currentContent,
24+
isLanding,
2325
allParamsObj,
2426
}: Props) => {
2527
// GENERAL
2628
const { hueRotation } = useContext(AppContext);
2729
const [isIntro, setIsIntro] = useState<boolean>(false);
30+
const [ignored, forceUpdate] = useReducer((x) => x + 1, 0);
2831

2932
useEffect(() => {
3033
if (allParamsObj.param2 === "introduction") {
@@ -34,6 +37,10 @@ const HomeViewHeader = ({
3437
}
3538
}, [allParamsObj.param2]);
3639

40+
useEffect(() => {
41+
forceUpdate();
42+
}, [isLanding]);
43+
3744
// Some elements in the return will be hidden by media query CSS, to allow UI elements in the header or footer depending on mobile / Desktop. This is why there are some "redundant" elements
3845
return (
3946
<div className='HomeViewHeader'>

src/components/LandingPage.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,22 @@ const LandingPage = ({ setIsLanding, setParamsArray }: Props) => {
9090
setParamsArray[1]("portfolio");
9191
setCurrentDisplay("Portfolio");
9292
setLink1Text("Web Dev");
93-
setLink1Path("/landing/portfolio/webdev");
93+
setLink1Path("/home/portfolio/webdev");
9494
setLink2Text("Game Dev");
95-
setLink2Path("/landing/portfolio/gamedev");
95+
setLink2Path("/home/portfolio/gamedev");
9696
setHueDuration(AppConfig.hueAnimDuration);
9797
} else if (currentPath === "/landing/blog") {
9898
setParamsArray[1]("blog");
9999
setCurrentDisplay("Blog");
100100
setLink1Text("Web Dev");
101-
setLink1Path("/landing/blog/webdev");
101+
setLink1Path("/home/blog/webdev");
102102
setLink2Text("Game Dev");
103-
setLink2Path("/landing/blog/gamedev");
103+
setLink2Path("/home/blog/gamedev");
104104
setHueDuration(AppConfig.hueAnimDuration);
105+
} else if (currentPath.endsWith("/gamedev")) {
106+
setParamsArray[2]("gamedev");
107+
} else if (currentPath.endsWith("/webdev")) {
108+
setParamsArray[2]("webdev");
105109
}
106110
}, [currentPath]);
107111

src/components/styles/WIPDisclaimer.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
font-family: "munro";
33
color: white;
44
position: absolute;
5-
bottom: 45%;
5+
bottom: 20%;
66
left: 50%;
77
transform: translate(-50%);
88
z-index: 100;
@@ -27,7 +27,7 @@
2727
.WIPDisclaimer .close-ctr {
2828
position: absolute;
2929
border: solid white 1px;
30-
left: 5px;
30+
right: 5px;
3131
top: 5px;
3232
}
3333

0 commit comments

Comments
 (0)