Skip to content

Instantly share code, notes, and snippets.

@icew1nd
Created May 25, 2021 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icew1nd/142d7e1f2d883559afac7a0832de13e0 to your computer and use it in GitHub Desktop.
Save icew1nd/142d7e1f2d883559afac7a0832de13e0 to your computer and use it in GitHub Desktop.
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