refactor: update layout to match nextjs 15 convention

This commit is contained in:
Alvalens 2025-03-18 11:31:48 +07:00
parent 553880a3e0
commit 80904c426d
3 changed files with 9 additions and 8 deletions

View file

@ -1,7 +1,7 @@
import Footer from "@/components/Footer"; import Footer from "@/components/Footer";
export const metadata = { export const metadata = {
title: "Alvalens | About", title: "Alvalens | About"
}; };
export default function Layout({ children }) { export default function Layout({ children }) {
return ( return (

View file

@ -1,5 +1,5 @@
"use client"; "use client";
import { useState, useEffect } from "react"; import { useState, useEffect, use } from "react";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import jsonData from "@/json/data.json"; import jsonData from "@/json/data.json";
@ -53,9 +53,10 @@ function ScrollDownButton() {
} }
function Page({ params }) { function Page(props) {
const [data, setData] = useState(null); const params = use(props.params);
useEffect(() => { const [data, setData] = useState(null);
useEffect(() => {
const selectedData = jsonData.Projects.find( const selectedData = jsonData.Projects.find(
(item) => item.slug === params.slug (item) => item.slug === params.slug
); );
@ -66,7 +67,7 @@ function Page({ params }) {
} }
}, [params.slug]); }, [params.slug]);
if (data === "404") { if (data === "404") {
return ( return (
<> <>
<NotFound /> <NotFound />
@ -98,7 +99,7 @@ function Page({ params }) {
</div> </div>
); );
} }
return ( return (
<div className="relative min-h-screen w-full gap-4 p-10 flex justify-center items-center flex-col mb-10 "> <div className="relative min-h-screen w-full gap-4 p-10 flex justify-center items-center flex-col mb-10 ">
<FixedButon href="/projects"> <FixedButon href="/projects">
<FontAwesomeIcon <FontAwesomeIcon

View file

@ -2,7 +2,7 @@
import Footer from "@/components/Footer"; import Footer from "@/components/Footer";
export const metadata = { export const metadata = {
title: "Alvalens | Projects", title: "Alvalens | Projects"
}; };
export default function Layout({ children }) { export default function Layout({ children }) {
return ( return (