Skip to content

Commit 5dff07e

Browse files
authored
Merge pull request #25 from Capstone-Projects-2022-Spring/BAZ-109-create-shopping-list-page-list-product-component
added functionality to add product button on shopping list page
2 parents 185ace1 + 3af2b31 commit 5dff07e

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/Components/Pages/ProductSearch/ProductSearch.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,10 @@ export function ProductSearch(props) {
179179
onSortModelChange={handleSortModelChange}
180180
onPageChange={handlePageChange}
181181
onPageSizeChange={handlePageSizeChange}
182+
onRowClick={productClicked}
182183
/>
183184
</div>
184185
</div>
185186
</>
186187
);
187-
}
188+
}

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)