You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
633 B
33 lines
633 B
1 year ago
|
import React from "react";
|
||
|
|
||
|
import Detail from "../components/Detail";
|
||
|
import List from "../components/List";
|
||
|
import { DetailedBook, SimpleBook, getBook, getAllBooks } from "../lib/books";
|
||
|
|
||
|
export default function Playground(props: Props) {
|
||
|
return (
|
||
|
<div>
|
||
|
<h1>Detail</h1>
|
||
|
<hr />
|
||
|
<Detail book={props.book} />
|
||
|
<h1>List</h1>
|
||
|
<hr />
|
||
|
<List books={props.books} />
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export async function getServerSideProps() {
|
||
|
return {
|
||
|
props: {
|
||
|
book: await getBook(44),
|
||
|
books: await getAllBooks(),
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
|
||
|
interface Props {
|
||
|
book: DetailedBook;
|
||
|
books: SimpleBook[];
|
||
|
}
|