Skip to content

Commit cae6198

Browse files
committed
added functionality to add product button on shopping list page
1 parent d67f654 commit cae6198

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/Components/Pages/ProductSearch/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
height: 300;
33
width: "100%";
44
} */
5+
56
.wrapper{
67
display: 'flex';
78
justify-content: 'center';

src/Components/Pages/ShoppingLists/ShoppingListView.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ListManagementDropdown from './ListManagementDropdown';
77
import Navbar from '../../NavBar/Navbar'
88
import { ProductSearch } from '../ProductSearch/ProductSearch';
99
import ErrorPage from "../404Page/ErrorPage"
10+
import { Link } from "react-router-dom";
1011

1112
export class ShoppingListView extends React.Component {
1213
constructor(props) {
@@ -25,12 +26,8 @@ export class ShoppingListView extends React.Component {
2526
this.togglePop = this.togglePop.bind(this);
2627
this.handleAddProduct = this.handleAddProduct.bind(this);
2728
this.handleRemoveProduct = this.handleRemoveProduct.bind(this);
28-
// this.updateCurrentProductIndex = this.updateCurrentProductIndex.bind(this);
29-
3029
}
3130

32-
33-
3431
changeListHandler(newIndex) {
3532
//alert('new list index: ' + newIndex);
3633
this.setState({
@@ -39,9 +36,6 @@ export class ShoppingListView extends React.Component {
3936
})
4037
}
4138

42-
43-
44-
4539
handleInput(event) {
4640
this.setState({value: event.target.value});
4741
}
@@ -132,7 +126,6 @@ export class ShoppingListView extends React.Component {
132126
});
133127
}
134128

135-
136129
handleRemoveProduct = (clickedIndex) => {
137130
//alert('called handleremoveproduct');
138131
//this.updateCurrentProductIndex(clickedIndex);
@@ -168,7 +161,9 @@ export class ShoppingListView extends React.Component {
168161
<ShoppingListSelection changeListHandler={this.changeListHandler} handleAddList={this.handleAddList} lists={this.state.lists} handleInput={this.handleInput} value={this.state.value} togglePop={this.togglePop} seen={this.state.seen}/>
169162
</div>
170163
<div className='productlistcolumn bg-purple-200'>
171-
<button onClick={this.handleAddProduct}>+ Add a Product</button>
164+
<Link to={`/search`} className="">
165+
<div className="px-2 py-1 text-sm rounded-full text-white bg-purple-600" >+ Add a Product</div>
166+
</Link>
172167
<ShoppingListDisplay displayIndex={this.state.listIndex} lists={this.state.lists} currentList={this.state.currentList} removeProduct={this.handleRemoveProduct} productIndex={this.state.productIndex}/>
173168

174169
</div>

src/Components/Pages/ShoppingLists/styles.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*body {
2+
height: 100%;
3+
overflow: auto;
4+
background-color:#E9D5FF;
5+
margin: 0px;
6+
padding: 0px;
7+
8+
}*/
9+
110
.container{
211
background: #FBE9E8;
312
width: 100%;

0 commit comments

Comments
 (0)