Created bookshelf component
This commit is contained in:
parent
59ba282634
commit
6574fefd36
@ -1,6 +1,5 @@
|
|||||||
.centredBlock {
|
.container {
|
||||||
display: flex;
|
height: 100vh;
|
||||||
align-items: center;
|
width: 100vw;
|
||||||
flex-direction: column;
|
overflow: hidden;
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import Bookshelf from "../Bookshelf";
|
||||||
import styles from "./App.module.css";
|
import styles from "./App.module.css";
|
||||||
|
|
||||||
export const App = () => (
|
export const App = () => (
|
||||||
<div className={styles.centredBlock}>
|
<div className={styles.container}>
|
||||||
<p>Hello, Publite</p>
|
<Bookshelf />
|
||||||
<img src="/logo.svg" alt="Publite logo" width="100px" />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export default App;
|
||||||
|
19
src/Bookshelf/Bookshelf.module.css
Normal file
19
src/Bookshelf/Bookshelf.module.css
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
.container {
|
||||||
|
padding: 15vh;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollContainer {
|
||||||
|
display: flex;
|
||||||
|
gap: 30px;
|
||||||
|
height: 100%;
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (orientation: portrait) {
|
||||||
|
.container {
|
||||||
|
padding: 15vh 30px;
|
||||||
|
}
|
||||||
|
}
|
23
src/Bookshelf/index.tsx
Normal file
23
src/Bookshelf/index.tsx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import { IBook } from "../types/book";
|
||||||
|
|
||||||
|
import styles from "./Bookshelf.module.css";
|
||||||
|
|
||||||
|
import list from "../assets/bookList.json";
|
||||||
|
import { BookItem } from "./BookItem";
|
||||||
|
|
||||||
|
export const Bookshelf = () => {
|
||||||
|
const [books, setBooks] = useState<IBook[]>(list);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.container}>
|
||||||
|
<div className={styles.scrollContainer}>
|
||||||
|
{books.map((book, index) => (
|
||||||
|
<BookItem key={book.hash} {...book} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Bookshelf;
|
Loading…
x
Reference in New Issue
Block a user