Skip to content

Instantly share code, notes, and snippets.

@icew1nd
Created May 25, 2021 19:33
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/d1f77547c4acb321acd04c7f5390b3fe to your computer and use it in GitHub Desktop.
Save icew1nd/d1f77547c4acb321acd04c7f5390b3fe 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 => (
<>
<Link href={link.link} passHref>
<a>{link.name}</a>
</Link>{" "}
</>
))}
</div>
</div>
);
};
const Footer = ({ menu }) => {
return (
<footer className={styles.footer}>
Copyright © verycoolsite.com
<div>
{menu.map(link => (
<>
<Link href={link.link} passHref>
<a>{link.name}</a>
</Link>{" "}
</>
))}
</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