-
-
Save icew1nd/142d7e1f2d883559afac7a0832de13e0 to your computer and use it in GitHub Desktop.
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
import styles from "../styles/Home.module.css"; | |
const Header = ({ menu }) => { | |
return ( | |
<div> | |
Some cool logo | |
<div> | |
{menu.map(link => ( | |
<a href={link.link}>{link.name} </a> | |
))} | |
</div> | |
</div> | |
); | |
}; | |
const Footer = ({ menu }) => { | |
return ( | |
<footer className={styles.footer}> | |
Copyright © verycoolsite.com | |
<div> | |
{menu.map(link => ( | |
<a href={link.link}>{link.name} </a> | |
))} | |
</div> | |
</footer> | |
); | |
}; | |
function Index({ navigation, content }) { | |
return ( | |
<div className={styles.container}> | |
<Header menu={navigation.headerNav} /> | |
<Content content={content} /> | |
<Footer menu={navigation.footerNav} /> | |
</div> | |
); | |
} | |
export async function getStaticProps(context) { | |
const res = await fetch( | |
`https://60ac26145a4de40017ccb8ce.mockapi.io/navigation` | |
); | |
const navigation = await res.json(); | |
const contentRes = await fetch( | |
`https://60ac26145a4de40017ccb8ce.mockapi.io/content?${page}` | |
); | |
const content = await contentRes.json(); | |
return { | |
props: { navigation, content, headline: page } | |
}; | |
} | |
export default Index; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment