Initial commit from Create Next App

This commit is contained in:
2021-10-12 21:17:12 +02:00
commit adc12fcae3
17 changed files with 2364 additions and 0 deletions

37
pages/users/index.tsx Normal file
View File

@@ -0,0 +1,37 @@
import { GetStaticProps } from 'next'
import Link from 'next/link'
import { User } from '../../interfaces'
import { sampleUserData } from '../../utils/sample-data'
import Layout from '../../components/Layout'
import List from '../../components/List'
type Props = {
items: User[]
}
const WithStaticProps = ({ items }: Props) => (
<Layout title="Users List | Next.js + TypeScript Example">
<h1>Users List</h1>
<p>
Example fetching data from inside <code>getStaticProps()</code>.
</p>
<p>You are currently on: /users</p>
<List items={items} />
<p>
<Link href="/">
<a>Go home</a>
</Link>
</p>
</Layout>
)
export const getStaticProps: GetStaticProps = async () => {
// Example for including static props in a Next.js function component page.
// Don't forget to include the respective types for any props passed into
// the component.
const items: User[] = sampleUserData
return { props: { items } }
}
export default WithStaticProps