Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Mogakamo/develop
Configured the project Layout component
- Loading branch information
Showing
5 changed files
with
56 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export {default as Banner} from "./Banner" | ||
export {default as CallToAction} from "./CallToAction" | ||
export {default as EventsPane} from "./EventsPane" | ||
export {default as Layout} from "./layout" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, {ReactNode} from "react"; | ||
import Nav from "./Nav"; | ||
import Footer from "./Footer"; | ||
|
||
type LayoutType = { | ||
children: ReactNode | ||
} | ||
|
||
const Layout = ({ children }: LayoutType) => { | ||
return ( | ||
<> | ||
<Nav /> | ||
<main>{children}</main> | ||
<Footer /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Layout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import '../styles/globals.css' | ||
import type { AppProps } from 'next/app' | ||
import "../styles/globals.css"; | ||
import type { AppProps } from "next/app"; | ||
import { NextPage } from "next"; | ||
import { ReactElement, ReactNode } from "react"; | ||
|
||
function MyApp({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} /> | ||
export type NextPageLayout = NextPage & { | ||
getLayout?: (page: ReactElement) => ReactNode | ||
} | ||
|
||
export default MyApp | ||
type AppPropsWithLayout = AppProps & { | ||
Component: NextPageLayout | ||
} | ||
|
||
function MyApp({ Component, pageProps }: AppPropsWithLayout) { | ||
const getLayout = Component.getLayout ?? ((page) => page) | ||
|
||
return getLayout(<Component {...pageProps} />); | ||
} | ||
|
||
export default MyApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,20 @@ | ||
import React, { useState } from 'react' | ||
import Banner from "../components/Banner"; | ||
import Footer from '../components/Footer'; | ||
import Nav from '../components/Nav'; | ||
import EventsPane from '../components/EventsPane' | ||
import Head from 'next/head'; | ||
import CallToAction from '../components/CallToAction' | ||
import React, { useState } from "react"; | ||
import Head from "next/head"; | ||
import Image from "next/image"; | ||
import { prependOnceListener } from "process"; | ||
import type { NextPage } from "next"; | ||
import { Banner, CallToAction, EventsPane, Layout } from "../components"; | ||
|
||
|
||
const Home = () => { | ||
return ( | ||
<> | ||
<Head> | ||
<title>She-Codes-Nairobi</title> | ||
</Head> | ||
<main className="w-full px-4 md:px-8 lg:px-20 text-darkAccent"> | ||
<Nav /> | ||
<Banner /> | ||
<CallToAction /> | ||
<EventsPane /> | ||
<Footer /> | ||
</main> | ||
</> | ||
); | ||
<main className="w-full px-4 md:px-8 lg:px-20 text-darkAccent"> | ||
<Layout> | ||
<Banner /> | ||
<EventsPane /> | ||
<CallToAction /> | ||
</Layout> | ||
</main> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Home; |