move header/footer to RootLayout
This commit is contained in:
@@ -12,7 +12,7 @@ export default function HeaderItem({
|
|||||||
}: HeaderItemProps) {
|
}: HeaderItemProps) {
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
className="inline text-green-500 hover:underline font-bold text-3xl pr-2"
|
className="inline text-green-500 hover:underline font-bold text-3xl text-center"
|
||||||
href={linkTo}
|
href={linkTo}
|
||||||
target={newWindow ? "_blank" : "_self"}
|
target={newWindow ? "_blank" : "_self"}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,21 +1,33 @@
|
|||||||
// component imports
|
// component imports
|
||||||
import Head from "./Head"
|
import Head from "./Head"
|
||||||
|
import Header from "./header";
|
||||||
|
import Footer from "./footer";
|
||||||
|
|
||||||
// react imports
|
// react imports
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
type LayoutProps = {
|
type LayoutProps = {
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
protectedPage?: boolean
|
protectedPage?: boolean,
|
||||||
|
showHeader: boolean,
|
||||||
|
isHomePage: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function RootLayout({ children }: LayoutProps) {
|
export default function RootLayout({
|
||||||
|
children,
|
||||||
|
showHeader = true,
|
||||||
|
isHomePage = true
|
||||||
|
}: LayoutProps) {
|
||||||
return (
|
return (
|
||||||
<main className="bg-black h-screen flex flex-col justify-center items-center overflow-y-hidden">
|
<main className="bg-black h-screen flex flex-col justify-center items-center overflow-y-hidden">
|
||||||
|
{ showHeader && <Header isHomePage={isHomePage} />}
|
||||||
|
|
||||||
<Head />
|
<Head />
|
||||||
<div className="flicker">
|
<div className="flicker">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Footer />
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
import HeaderItem from "./HeaderItem";
|
import HeaderItem from "./HeaderItem";
|
||||||
|
|
||||||
type HeaderProps = {
|
type HeaderProps = {
|
||||||
isNotHomePage: boolean
|
isHomePage: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Header({
|
export default function Header({
|
||||||
isNotHomePage = false
|
isHomePage = false
|
||||||
}: HeaderProps) {
|
}: HeaderProps) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="text-white max-w-md mx-auto pt-2 pb-4 text-center">
|
<div className="text-white mx-auto my-4 lg:max-w-md">
|
||||||
<div className="inline-block pb-2 space-x-6">
|
<div className="inline-block pb-2 space-x-2">
|
||||||
<HeaderItem content="HOME" linkTo={
|
<HeaderItem content="HOME" linkTo={
|
||||||
isNotHomePage ? "/?noAnimation"
|
!isHomePage ? "/?noAnimation"
|
||||||
: "/"
|
: "/"
|
||||||
} />
|
} />
|
||||||
<HeaderItem content="LINKS" linkTo="/links" />
|
<HeaderItem content="LINKS" linkTo="/links" />
|
||||||
|
|||||||
+5
-9
@@ -1,16 +1,12 @@
|
|||||||
import RootLayout from "@/components/RootLayout";
|
import RootLayout from "@/components/RootLayout";
|
||||||
import Footer from "@/components/footer";
|
|
||||||
import Header from "@/components/header";
|
|
||||||
|
|
||||||
export default function AboutPage() {
|
export default function AboutPage() {
|
||||||
return (
|
return (
|
||||||
<RootLayout>
|
<RootLayout isHomePage={false} showHeader={true}>
|
||||||
<Header isNotHomePage={true} />
|
<div className="text-center text-green-500">
|
||||||
<div className="text-center text-green-500">
|
<h1 className="font-bold text-2xl">About this website</h1>
|
||||||
<h1 className="font-bold text-2xl">About this website</h1>
|
<p className="max-w-10">This is just a hobby project I thought was cool!<br /> I plan to play with it a bit to grasp more CSS, but so far, pretty cool right?</p>
|
||||||
<p className="max-w-10">This is just a hobby project I thought was cool!<br /> I plan to play with it a bit to grasp more CSS, but so far, pretty cool right?</p>
|
</div>
|
||||||
</div>
|
|
||||||
<Footer />
|
|
||||||
</RootLayout>
|
</RootLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+5
-6
@@ -1,11 +1,10 @@
|
|||||||
import RootLayout from '@/components/RootLayout';
|
import RootLayout from '@/components/RootLayout';
|
||||||
import Header from '@/components/header';
|
|
||||||
import Footer from '@/components/footer';
|
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const [doAnimation, setDoAnimation] = useState<boolean>(false);
|
const [doAnimation, setDoAnimation] = useState<boolean>(false);
|
||||||
const [pastLogo, setPastLogo] = useState<boolean>(false);
|
const [pastLogo, setPastLogo] = useState<boolean>(false);
|
||||||
|
const [pastAnim, setPastAnim] = useState<boolean>(false);
|
||||||
const [text, setText] = useState<string[]>([]);
|
const [text, setText] = useState<string[]>([]);
|
||||||
|
|
||||||
const generateRandomTextString = () => {
|
const generateRandomTextString = () => {
|
||||||
@@ -22,6 +21,7 @@ export default function Home() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (location.href.includes("?noAnimation")) {
|
if (location.href.includes("?noAnimation")) {
|
||||||
|
setPastAnim(true)
|
||||||
const logoElement = document.getElementById("pipboy");
|
const logoElement = document.getElementById("pipboy");
|
||||||
const textElement = document.getElementById("textwall");
|
const textElement = document.getElementById("textwall");
|
||||||
const mainElement = document.getElementById("mainelement");
|
const mainElement = document.getElementById("mainelement");
|
||||||
@@ -61,6 +61,7 @@ export default function Home() {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
if (textElement && mainElement) {
|
if (textElement && mainElement) {
|
||||||
|
setPastAnim(true)
|
||||||
textElement.style.display = "none"
|
textElement.style.display = "none"
|
||||||
mainElement.style.display = "block"
|
mainElement.style.display = "block"
|
||||||
}
|
}
|
||||||
@@ -69,7 +70,7 @@ export default function Home() {
|
|||||||
}, [pastLogo, doAnimation])
|
}, [pastLogo, doAnimation])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RootLayout>
|
<RootLayout isHomePage={true} showHeader={pastAnim}>
|
||||||
{/* "logo", hidden after 4 seconds */}
|
{/* "logo", hidden after 4 seconds */}
|
||||||
<h1 className="text-green-500 text-9xl font-bold italic select-none" id="pipboy">Pip-Boy</h1>
|
<h1 className="text-green-500 text-9xl font-bold italic select-none" id="pipboy">Pip-Boy</h1>
|
||||||
|
|
||||||
@@ -78,14 +79,12 @@ export default function Home() {
|
|||||||
|
|
||||||
{/* and the content :) */}
|
{/* and the content :) */}
|
||||||
<div className="text-green-500 flicker max-w-1/2 hidden" id="mainelement">
|
<div className="text-green-500 flicker max-w-1/2 hidden" id="mainelement">
|
||||||
<Header isNotHomePage={false} />
|
<div className="text-center">
|
||||||
<div className="text-left">
|
|
||||||
<p className="text-md">
|
<p className="text-md">
|
||||||
<span className="font-bold text-2xl">Hello traveller!</span>
|
<span className="font-bold text-2xl">Hello traveller!</span>
|
||||||
</p>
|
</p>
|
||||||
<p>Welcome to my website! Feel free to explore & learn more about me :)</p>
|
<p>Welcome to my website! Feel free to explore & learn more about me :)</p>
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
|
||||||
</div>
|
</div>
|
||||||
</RootLayout>
|
</RootLayout>
|
||||||
)
|
)
|
||||||
|
|||||||
+18
-46
@@ -1,61 +1,33 @@
|
|||||||
import RootLayout from "@/components/RootLayout";
|
import RootLayout from "@/components/RootLayout";
|
||||||
import Footer from "@/components/footer";
|
|
||||||
import Header from "@/components/header";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import {useState} from 'react';
|
|
||||||
|
|
||||||
// icons
|
|
||||||
import {
|
|
||||||
Twitter,
|
|
||||||
MailOption,
|
|
||||||
AddCircle
|
|
||||||
} from 'grommet-icons'
|
|
||||||
|
|
||||||
export default function LinksPage() {
|
export default function LinksPage() {
|
||||||
const [icon, setIcon] = useState(<AddCircle size="large" />);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RootLayout>
|
<RootLayout showHeader={true} isHomePage={false}>
|
||||||
<Header isNotHomePage={true} />
|
<div className="text-green-500">
|
||||||
<div className="text-green-500 max-h-96">
|
<h1 className="text-3xl font-bold">
|
||||||
<h1 className="font-bold text-3xl ml-2">My Links!</h1>
|
My Links!
|
||||||
<div className="space-y-2 float-left">
|
</h1>
|
||||||
<Link
|
|
||||||
href="https://twitter.com/avvex__"
|
<div className="space-y-2">
|
||||||
target="_blank"
|
<Link
|
||||||
onMouseOver={() => {
|
href="https://twitter.com/avvex__"
|
||||||
setIcon(<Twitter size="large" />)
|
|
||||||
}}
|
|
||||||
onMouseLeave={() => {
|
|
||||||
setIcon(<AddCircle size="large" />)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="hover:bg-green-500 hover:text-black">
|
|
||||||
<h1 className="text-2xl mr-32 ml-2">Twitter</h1>
|
|
||||||
</div>
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
href="https://mast.thatalex.dev/@alex"
|
|
||||||
target="_blank"
|
target="_blank"
|
||||||
onMouseOver={() => {
|
|
||||||
setIcon(<MailOption size="large" />)
|
|
||||||
}}
|
|
||||||
onMouseLeave={() => {
|
|
||||||
setIcon(<AddCircle size="large" />)
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<div className="hover:bg-green-500 hover:text-black">
|
<div className="hover:bg-green-500 hover:text-black">
|
||||||
<h1 className="text-2xl mr-32 ml-2">Mastodon</h1>
|
<h1 className="text-2xl text-center">Twitter</h1>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
href="https://mast.thatalex.dev/@alex"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
<div className="hover:bg-green-500 hover:text-black">
|
||||||
|
<h1 className="text-2xl text-center">Mastodon</h1>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="float-right">
|
|
||||||
{/* <Twitter size='xlarge' className="mr-24" /> */}
|
|
||||||
{icon}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
|
||||||
</RootLayout>
|
</RootLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
import RootLayout from "@/components/RootLayout";
|
import RootLayout from "@/components/RootLayout";
|
||||||
import Footer from "@/components/footer";
|
|
||||||
import Header from "@/components/header";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
export default function ProjectsPage() {
|
export default function ProjectsPage() {
|
||||||
return (
|
return (
|
||||||
<RootLayout>
|
<RootLayout showHeader={true} isHomePage={false}>
|
||||||
<Header isNotHomePage={true} />
|
|
||||||
<div className="space-y-2 text-center">
|
<div className="space-y-2 text-center">
|
||||||
<Link href="https://github.com/azpha/splitstat" target="_blank">
|
<Link href="https://github.com/azpha/splitstat" target="_blank">
|
||||||
<div className="hover:bg-green-500 hover:text-black text-green-500">
|
<div className="hover:bg-green-500 hover:text-black text-green-500">
|
||||||
@@ -28,7 +25,6 @@ export default function ProjectsPage() {
|
|||||||
<h1 className=" text-2xl mx-32">Watchlist</h1>
|
<h1 className=" text-2xl mx-32">Watchlist</h1>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Footer />
|
|
||||||
</div>
|
</div>
|
||||||
</RootLayout>
|
</RootLayout>
|
||||||
)
|
)
|
||||||
|
|||||||
+10
-7
@@ -1,6 +1,4 @@
|
|||||||
import RootLayout from "@/components/RootLayout";
|
import RootLayout from "@/components/RootLayout";
|
||||||
import Footer from "@/components/footer";
|
|
||||||
import Header from "@/components/header";
|
|
||||||
import { api } from "@/utils/api";
|
import { api } from "@/utils/api";
|
||||||
|
|
||||||
// next components
|
// next components
|
||||||
@@ -11,23 +9,29 @@ export default function MusicPage() {
|
|||||||
const { data: musicData, fetchStatus} = api.misc.song.useQuery();
|
const { data: musicData, fetchStatus} = api.misc.song.useQuery();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RootLayout>
|
<RootLayout showHeader={true} isHomePage={false}>
|
||||||
<Header isNotHomePage={true} />
|
|
||||||
<div className="text-green-500 flicker max-w-1/2">
|
<div className="text-green-500 flicker max-w-1/2">
|
||||||
<div className="float-left">
|
<div className="float-left mr-10">
|
||||||
{
|
{
|
||||||
fetchStatus === "idle" ?
|
fetchStatus === "idle" ?
|
||||||
musicData?.data.tracks.map((v,k) => {
|
musicData?.data.tracks.map((v,k) => {
|
||||||
return <div key={k}>
|
return <div key={k}>
|
||||||
<div className={`text-lg ${k === 0 ? "bg-green-500 text-black" : "hover:bg-green-500 hover:text-black"}`}>
|
<div className={`text-lg ${k === 0 ? "bg-green-500 text-black" : "hover:bg-green-500 hover:text-black"}`}>
|
||||||
<Link href={v.url} target="_blank">
|
<Link href={v.url} target="_blank">
|
||||||
<h1 className="ml-2 mr-36 truncate max-w-10">{k === 0 && "■"} {v.name}</h1>
|
<h1 className="ml-2 mr-10 truncate max-w-10">{k === 0 && "■"} {v.name}</h1>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
})
|
})
|
||||||
: <h1 className="font-bold text-green-500">Fetching..</h1>
|
: <h1 className="font-bold text-green-500">Fetching..</h1>
|
||||||
}
|
}
|
||||||
|
<Link
|
||||||
|
href="https://last.fm/user/lulawex"
|
||||||
|
target="_blank"
|
||||||
|
className="hover:underline"
|
||||||
|
>
|
||||||
|
<p>Powered by Last.fm</p>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className="float-right">
|
<div className="float-right">
|
||||||
{
|
{
|
||||||
@@ -41,7 +45,6 @@ export default function MusicPage() {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
|
||||||
</RootLayout>
|
</RootLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user