diff --git a/src/components/Books/BooksList.js b/src/components/Books/BooksList.js index a5318edd7..b4f5069f3 100644 --- a/src/components/Books/BooksList.js +++ b/src/components/Books/BooksList.js @@ -1,11 +1,15 @@ -import React from 'react'; +import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { BUTTON_TYPES } from '@george-gillams/components/button/constants'; import { StyledBookCard, StyledButton, StyledFeatureCard } from './books-list.styles'; +import FormBuilder from '@george-gillams/components/form-builder'; const BooksList = props => { - const { admin, books, deleteBook, linkPrefix, ...rest } = props; + const { admin, books, updateBook, deleteBook, linkPrefix, ...rest } = props; + + // TODO Put this inside book editor component + const [updatedBook, setUpdatedBook] = useState({}); return (
@@ -13,6 +17,60 @@ const BooksList = props => { {books.map(book => (
+ {updateBook && ( + { + console.log(`onDataChanged`, book); + setUpdatedBook(book); + }} + onSubmit={updateBook} + submitLabel={'Save'} + /> + )} {deleteBook && ( { const admin = authenticatorState.user && authenticatorState.user.admin; + const updateBook = book => { + console.log(`updateBook`, book); + }; + return ( <> @@ -44,7 +48,12 @@ const ReadingList = props => { <> {booksToRender && ( - + )}