diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 45eeb1a..1ed27b6 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -5,9 +5,11 @@ export default function Footer() { const [mailState, setMailState] = useState(false); useEffect(() => { - setTimeout(() => { - setMailState(false) - }, 3000) + if (mailState) { + setTimeout(() => { + setMailState(false) + }, 3000) + } }, [mailState]) return ( diff --git a/src/components/Project.tsx b/src/components/ProjectCard.tsx similarity index 100% rename from src/components/Project.tsx rename to src/components/ProjectCard.tsx diff --git a/src/components/ProjectComponent.tsx b/src/components/ProjectComponent.tsx new file mode 100644 index 0000000..117b143 --- /dev/null +++ b/src/components/ProjectComponent.tsx @@ -0,0 +1,29 @@ +export default function ProjectComponent({ + url, + header, + subheader, + image, + imageSize = "100" +}: { + url: string, + header: string, + subheader: string, + image: string, + imageSize?: string +}) { + return ( + +
+
+ + +
+

{header}

+
+

{subheader}

+
+
+
+
+ ) +} \ No newline at end of file diff --git a/src/components/ProjectComponents/RecentListens.tsx b/src/components/ProjectComponents/RecentListens.tsx index b94dea1..332d596 100644 --- a/src/components/ProjectComponents/RecentListens.tsx +++ b/src/components/ProjectComponents/RecentListens.tsx @@ -1,4 +1,5 @@ import { useState, useEffect } from 'react'; +import ProjectComponent from '../ProjectComponent'; type MusicAPIResponse = { data: { @@ -50,35 +51,14 @@ export default function RecentListens() { setLoading(false); }, []); - if (data) { + if (!loading && data) { return ( - -
- { - (loading) ? ( -

Loading..

- ) : (!errorState && data) ? ( -
- v.size === "large")[0]['#text']} - width="100" - /> -
-

{data[0].name}

- -

{data[0].artist['#text']}

-
-
- ) : ( - <> -

Failed to fetch :(

-

Check out last.fm/lulawex if this isn't working.

-

{errorState}

- - ) - } -
- + v.size === "large")[0]["#text"]} + /> ) } else { <> diff --git a/src/components/ProjectComponents/RecentPhoto.tsx b/src/components/ProjectComponents/RecentPhoto.tsx index fbbfa36..f43dbd2 100644 --- a/src/components/ProjectComponents/RecentPhoto.tsx +++ b/src/components/ProjectComponents/RecentPhoto.tsx @@ -1,4 +1,5 @@ import { useState, useEffect } from 'react'; +import ProjectComponent from '../ProjectComponent'; type PhotoData = { id: number, @@ -45,34 +46,24 @@ export default function RecentPhoto() { return `${jsDate.getFullYear()}/${jsDate.getMonth() + 1}/${jsDate.getDate()}`; } - return ( - -
- { - (loading) ? ( -

Loading..

- ) : (!errorState && data) ? ( -
- -
-

{data.name}

- -

{parseDate(data.dateTaken as Date)}

-
-
- ) : ( - <> -

Failed to fetch :(

-

Check out photos.alexav.gg if this isn't working.

-

{errorState}

- - ) - } -
- - ) + if (data && !loading) { + return ( + + ) + } else { + return ( + <> +

No data :(

+

Check out photos.alexav.gg if this isn't working.

+

{errorState}

+ + ) + } } \ No newline at end of file diff --git a/src/components/ProjectComponents/RecentWatch.tsx b/src/components/ProjectComponents/RecentWatch.tsx index 86390d3..d4f8b44 100644 --- a/src/components/ProjectComponents/RecentWatch.tsx +++ b/src/components/ProjectComponents/RecentWatch.tsx @@ -1,4 +1,5 @@ import { useState, useEffect } from 'react'; +import ProjectComponent from '../ProjectComponent'; type WatchDataResponse = { status: number, @@ -48,42 +49,23 @@ export default function RecentWatch() { return `${jsDate.getFullYear()}/${jsDate.getMonth() + 1}/${jsDate.getDate()}`; } - return ( - -
- { - loading ? ( -

Loading..

- ) : !errorState ? ( -
- -
-

{data?.title}

- - { - data?.finished ? ( -

Finished!

- ) : ( -

Started on {parseDate(new Date(data?.startedOn as Date))}

- ) - } - -

{data?.currentEpisode}

-
-
- ) : ( - <> -

Failed to fetch :(

-

Check out watch.alexav.gg if this isn't working.

-

{errorState}

- - ) - } -
- - ) - + if (data && !loading) { + return ( + + ) + } else { + return ( + <> +

No data :(

+

Check out watch.alexav.gg if this isn't working.

+

{errorState}

+ + ) + } } \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 8a8b07c..7cc4b46 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,7 +1,7 @@ import Footer from "./components/Footer"; import Header from "./components/Header"; import ListBox from "./components/ListBox"; -import Project from "./components/Project"; +import Project from "./components/ProjectCard"; import ContactForm from "./components/ContactForm"; // project components @@ -45,7 +45,7 @@ export default function Home() {
-
+

What am I watching?

Cool shows and movies I'm watching

@@ -59,7 +59,7 @@ export default function Home() {
-

What am I picturing?

+

What am I capturing?

Cool game photos I've taken recently

@@ -87,8 +87,9 @@ export default function Home() {

About Me

- I'm a junior developer with a burning passion for creating not only frontend applications, but also games. - I have experience in languages like JavaScript and Python, along with libraries like React. + I'm a "junior" developer with a passion for software and games. + I have experience in languages like JavaScript and Python, and am primarily + working in libraries like React.