refactor: create default layout for common pages

This commit is contained in:
Refansa 2024-08-03 10:43:03 +07:00
parent 7bd2e47024
commit f4b3fb54a9
6 changed files with 32 additions and 24 deletions

View File

@ -1,7 +1,6 @@
import { Metadata } from 'next' import { Metadata } from 'next'
import Header from '@/components/blocks/header/header' import DefaultLayout from '@/components/layouts/DefaultLayout'
import Footer from '@/components/blocks/footer/footer'
import UnderConstruction from '@/components/blocks/error/under-construction' import UnderConstruction from '@/components/blocks/error/under-construction'
export const metadata: Metadata = { export const metadata: Metadata = {
@ -10,12 +9,10 @@ export const metadata: Metadata = {
export default function Blog() { export default function Blog() {
return ( return (
<div className="max-w-screen-lg w-full mx-auto px-6"> <DefaultLayout>
<Header />
<main className="flex justify-center items-center h-[85vh]"> <main className="flex justify-center items-center h-[85vh]">
<UnderConstruction /> <UnderConstruction />
</main> </main>
<Footer /> </DefaultLayout>
</div>
) )
} }

View File

@ -1,6 +1,6 @@
import { Metadata } from 'next' import { Metadata } from 'next'
import Header from '@/components/blocks/header/header' import DefaultLayout from '@/components/layouts/DefaultLayout'
import PageNotFound from '@/components/blocks/error/page-not-found' import PageNotFound from '@/components/blocks/error/page-not-found'
export const metadata: Metadata = { export const metadata: Metadata = {
@ -9,11 +9,10 @@ export const metadata: Metadata = {
export default function NotFound() { export default function NotFound() {
return ( return (
<div className="max-w-screen-lg w-full mx-auto px-6"> <DefaultLayout>
<Header />
<main className="flex justify-center items-center h-[85vh]"> <main className="flex justify-center items-center h-[85vh]">
<PageNotFound /> <PageNotFound />
</main> </main>
</div> </DefaultLayout>
) )
} }

View File

@ -1,19 +1,16 @@
import Header from '@/components/blocks/header/header' import DefaultLayout from '@/components/layouts/DefaultLayout'
import Footer from '@/components/blocks/footer/footer' import IntroductionSection from '@/components/blocks/home/introduction-section'
import AboutSection from '@/components/blocks/home/about-section' import AboutSection from '@/components/blocks/home/about-section'
import ContactSection from '@/components/blocks/home/contact-section' import ContactSection from '@/components/blocks/home/contact-section'
import IntroductionSection from '@/components/blocks/home/introduction-section'
export default function Home() { export default function Home() {
return ( return (
<div className="max-w-screen-lg w-full mx-auto px-6"> <DefaultLayout>
<Header />
<main className="flex flex-col gap-24 mb-24"> <main className="flex flex-col gap-24 mb-24">
<IntroductionSection /> <IntroductionSection />
<AboutSection /> <AboutSection />
<ContactSection /> <ContactSection />
</main> </main>
<Footer /> </DefaultLayout>
</div>
) )
} }

View File

@ -1,7 +1,6 @@
import { Metadata } from 'next' import { Metadata } from 'next'
import Header from '@/components/blocks/header/header' import DefaultLayout from '@/components/layouts/DefaultLayout'
import Footer from '@/components/blocks/footer/footer'
import UnderConstruction from '@/components/blocks/error/under-construction' import UnderConstruction from '@/components/blocks/error/under-construction'
export const metadata: Metadata = { export const metadata: Metadata = {
@ -10,12 +9,10 @@ export const metadata: Metadata = {
export default function Projects() { export default function Projects() {
return ( return (
<div className="max-w-screen-lg w-full mx-auto px-6"> <DefaultLayout>
<Header />
<main className="flex justify-center items-center h-[85vh]"> <main className="flex justify-center items-center h-[85vh]">
<UnderConstruction /> <UnderConstruction />
</main> </main>
<Footer /> </DefaultLayout>
</div>
) )
} }

View File

@ -3,7 +3,7 @@ import Package from '../../../../package.json'
export default function Footer() { export default function Footer() {
return ( return (
<footer className="flex flex-col gap-1 items-center mb-8"> <footer className="flex flex-col gap-1 items-center mb-8 text-xs md:text-base">
<p className="font-semibold text-center">Site Version: {Package.version}</p> <p className="font-semibold text-center">Site Version: {Package.version}</p>
<p className="font-semibold text-center"> <p className="font-semibold text-center">
Created with by <Anchor href={Package.author.url}>{Package.author.nickname}</Anchor> Created with by <Anchor href={Package.author.url}>{Package.author.nickname}</Anchor>

View File

@ -0,0 +1,18 @@
import { ReactNode } from 'react'
import Header from '@/components/blocks/header/header'
import Footer from '@/components/blocks/footer/footer'
export interface Props {
children: ReactNode
}
export default function DefaultLayout({ children }: Props) {
return (
<div className="max-w-screen-lg w-full mx-auto px-6">
<Header />
{children}
<Footer />
</div>
)
}