Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ecommerce-maven
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ascend
ecommerce-maven
Commits
121f21bd
Commit
121f21bd
authored
May 12, 2021
by
Kyle Muldoon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quantity field repaired, each list item given a key, IDs on list-items changed to className
parent
5a11c551
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
19 deletions
+23
-19
CartItem.js
ecom-web/src/components/shopping-cart/CartItem.js
+9
-9
shopping-cart.css
ecom-web/src/components/shopping-cart/shopping-cart.css
+7
-7
shopping-cart.js
ecom-web/src/components/shopping-cart/shopping-cart.js
+7
-3
No files found.
ecom-web/src/components/shopping-cart/CartItem.js
View file @
121f21bd
...
...
@@ -9,25 +9,25 @@ export default function CartItem(props) {
{
/* Flex-Direction: Row */
}
{
/* Left image div */
}
<
div
id
=
"productImageContainer"
>
<
img
className
=
"productImage"
alt
=
""
src
=
{
props
.
productInfo
.
productImageUrl
}
/
>
<
div
className
=
"productImageContainer"
>
<
img
className
=
"productImage"
alt
=
"
Product
"
src
=
{
props
.
productInfo
.
productImageUrl
}
/
>
<
/div
>
{
/* Name and Product details */
}
<
div
id
=
"nameAndDetails"
>
<
div
id
=
"productName"
>
{
props
.
productInfo
.
productName
}
<
/div
>
<
div
id
=
"productStock"
>
{
props
.
productInfo
.
availableStock
}
left
in
stock
<
/div
>
<
div
className
=
"nameAndDetails"
>
<
div
className
=
"productName"
>
{
props
.
productInfo
.
productName
}
<
/div
>
<
div
className
=
"productStock"
>
{
props
.
productInfo
.
availableStock
}
left
in
stock
<
/div
>
<
div
id
=
"quantityControls"
>
<
select
id
=
"productQuantitySelect"
><
option
>
{
props
.
productInfo
.
quantity
}
<
/option></
select
>
<
div
className
=
"quantityControls"
>
<
select
className
=
"productQuantitySelect"
><
option
>
{
props
.
quantity
}
<
/option></
select
>
<
button
>
Delete
<
/button
>
<
/div
>
<
/div
>
{
/* Price and promotions */
}
<
div
id
=
"priceAndPromotions"
>
<
div
id
=
"productPrice"
>
$
{
props
.
productInfo
.
price
.
toFixed
(
2
)}
<
/div
>
<
div
className
=
"priceAndPromotions"
>
<
div
className
=
"productPrice"
>
$
{
props
.
productInfo
.
price
.
toFixed
(
2
)}
<
/div
>
<
/div
>
<
/div
>
...
...
ecom-web/src/components/shopping-cart/shopping-cart.css
View file @
121f21bd
...
...
@@ -34,13 +34,13 @@
justify-content
:
space-between
;
}
#
productName
{
.
productName
{
padding-top
:
25px
;
margin-bottom
:
15px
;
font-size
:
125%
;
}
#
productImageContainer
{
.
productImageContainer
{
display
:
flex
;
width
:
30%
;
margin-right
:
20px
;
...
...
@@ -56,7 +56,7 @@
/* max-height: 100%; */
}
#
nameAndDetails
{
.
nameAndDetails
{
display
:
flex
;
width
:
45%
;
height
:
200px
;
...
...
@@ -64,7 +64,7 @@
text-align
:
left
;
}
#
priceAndPromotions
{
.
priceAndPromotions
{
display
:
flex
;
width
:
10%
;
height
:
200px
;
...
...
@@ -73,20 +73,20 @@
align-items
:
flex-end
;
}
#
productPrice
{
.
productPrice
{
margin-top
:
40px
;
font-size
:
125%
;
font-weight
:
bold
;
}
#
quantityControls
{
.
quantityControls
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
flex-start
;
align-items
:
flex-end
;
}
#
productQuantitySelect
{
.
productQuantitySelect
{
width
:
40px
;
}
...
...
ecom-web/src/components/shopping-cart/shopping-cart.js
View file @
121f21bd
...
...
@@ -16,12 +16,16 @@ export default function ShoppingCart() {
const
productsFromRefs
=
[]
cartRefs
.
map
((
cartRef
)
=>
{
productsFromRefs
.
push
(
allProducts
.
filter
((
currProduct
)
=>
currProduct
.
sku
===
cartRef
.
productRef
.
sku
)[
0
])
let
tempCartItem
=
{
product
:
allProducts
.
filter
((
currProduct
)
=>
currProduct
.
sku
===
cartRef
.
productRef
.
sku
)[
0
],
quantity
:
cartRef
.
quantity
}
productsFromRefs
.
push
(
tempCartItem
)
})
setCartItems
(
productsFromRefs
)
},
[
cartRefs
])
...
...
@@ -33,7 +37,7 @@ export default function ShoppingCart() {
<
div
id
=
"cartItemList"
>
{
cartItems
.
map
((
currItem
)
=>
{
return
(
<
CartItem
productInfo
=
{
currItem
}
/
>
<
CartItem
productInfo
=
{
currItem
.
product
}
quantity
=
{
currItem
.
quantity
}
key
=
{
currItem
.
product
.
sku
}
/
>
)
})}
<
/div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment