Skip to content
Snippets Groups Projects
Commit 9fca7bdd authored by Alf Eaton's avatar Alf Eaton Committed by john
Browse files

Add UI for removing a book

parent a6733f2a
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,12 @@ export class BookList extends React.Component { ...@@ -34,6 +34,12 @@ export class BookList extends React.Component {
this._toggleModal() this._toggleModal()
} }
_removeCollection = (collection) => {
if (confirm('Remove this book?')) {
this.props.actions.deleteCollection(collection)
}
}
render () { render () {
const { books } = this.props const { books } = this.props
const { showModal } = this.state const { showModal } = this.state
...@@ -63,7 +69,12 @@ export class BookList extends React.Component { ...@@ -63,7 +69,12 @@ export class BookList extends React.Component {
{books ? books.map(book => ( {books ? books.map(book => (
<div key={book.id} className={styles.bookContainer}> <div key={book.id} className={styles.bookContainer}>
<h2>{book.title}</h2> <h2>{book.title}</h2>
<Link to={`/books/${book.id}/book-builder`} className={styles.editBook}>Edit</Link>
<div className={styles.bookActions}>
<Link to={`/books/${book.id}/book-builder`} className={styles.editBook}>Edit</Link>
<a href="#" onClick={() => this._removeCollection(book)} className={styles.editBook}>Remove</a>
</div>
</div> </div>
)) : 'Fetching…' } )) : 'Fetching…' }
</div> </div>
......
...@@ -56,6 +56,13 @@ $primary-color: #515253; ...@@ -56,6 +56,13 @@ $primary-color: #515253;
padding-bottom: 0; padding-bottom: 0;
padding-left: 2em; padding-left: 2em;
padding-top: 0; padding-top: 0;
position: relative;
}
.bookActions {
bottom: 0;
right: 13px;
position: absolute;
} }
.editBook { .editBook {
...@@ -63,10 +70,8 @@ $primary-color: #515253; ...@@ -63,10 +70,8 @@ $primary-color: #515253;
text-decoration: none; text-decoration: none;
font-style: italic; font-style: italic;
font-weight: 500; font-weight: 500;
right: 13px; display: inline-block;
display: block; margin-left: 13px;
bottom: 0;
position: absolute;
&:hover { &:hover {
color:#502424; color:#502424;
text-decoration: none; text-decoration: none;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment