Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Third branch #145

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
c6ab9dd
applied modify to App css file changed value of landing content in ma…
8KINTARO8 Dec 2, 2024
eb766d3
improve readability about css file App css to recollocated block of c…
8KINTARO8 Dec 2, 2024
2194098
implemented function map in render for make rendering object with ima…
8KINTARO8 Dec 2, 2024
ed13350
modified layout name in rendring of objects list now the position and…
8KINTARO8 Dec 2, 2024
6f849ff
add button in articles list modified to css file in product list css …
8KINTARO8 Dec 3, 2024
7939505
added comma for improve functionality about over and under line at pl…
8KINTARO8 Dec 7, 2024
bb401b9
implemented reducers in cartslice jsx addtocart removeitem updatequan…
8KINTARO8 Dec 7, 2024
3050ff4
implemented body of function in calculatetotalamount
8KINTARO8 Dec 7, 2024
1c1f124
modified cartslice jsx file in the function addtocart into if added r…
8KINTARO8 Dec 8, 2024
42ea819
implemented handlecontinueshopping in cartitem jsx file the function …
8KINTARO8 Dec 8, 2024
fe4bbaa
implemented alert by function handlecheckout shopping so when the onc…
8KINTARO8 Dec 8, 2024
59d0138
into cartitem jsx file implemented functions handleincrement and hand…
8KINTARO8 Dec 8, 2024
0fe0d02
added comment for function calculatetotalcost
8KINTARO8 Dec 8, 2024
caf4c59
implemented const totaloutput that receives cartdotreduce into calcul…
8KINTARO8 Dec 13, 2024
3476426
into productlist jsx file added totalitemcart function this is implem…
8KINTARO8 Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
into productlist jsx file added totalitemcart function this is implem…
…ented into svg tag for return total items quantity added to cart this value is shown into nav bar in center of cart icon
8KINTARO8 committed Dec 13, 2024
commit 3476426642ebd40b6cf9b96bc1abef9a170e6da9
7 changes: 6 additions & 1 deletion src/ProductList.jsx
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import {addItem} from './CartSlice'
function ProductList() {
const [showCart, setShowCart] = useState(false);
const [showPlants, setShowPlants] = useState(false); // State to control the visibility of the About Us page
const cart= useSelector(state=>state.cart.items);
const dispatch = useDispatch();
const plantsArray = [
{
@@ -262,6 +263,10 @@ const handlePlantsClick = (e) => {
e.preventDefault();
setShowCart(false);
};
const totalItemsCart = ()=>{
const totalQuantityOutput = cart.reduce((total,item)=> total+ item.quantity,0);
return totalQuantityOutput;
}
return (
<div>
<div className="navbar" style={styleObj}>
@@ -279,7 +284,7 @@ const handlePlantsClick = (e) => {
</div>
<div style={styleObjUl}>
<div> <a href="#" onClick={(e)=>handlePlantsClick(e)} style={styleA}>Plants</a></div>
<div> <a href="#" onClick={(e) => handleCartClick(e)} style={styleA}><h1 className='cart'><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" id="IconChangeColor" height="68" width="68"><rect width="156" height="156" fill="none"></rect><circle cx="80" cy="216" r="12"></circle><circle cx="184" cy="216" r="12"></circle><path d="M42.3,72H221.7l-26.4,92.4A15.9,15.9,0,0,1,179.9,176H84.1a15.9,15.9,0,0,1-15.4-11.6L32.5,37.8A8,8,0,0,0,24.8,32H8" fill="none" stroke="#faf9f9" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" id="mainIconPathAttribute"></path></svg></h1></a></div>
<div> <a href="#" onClick={(e) => handleCartClick(e)} style={styleA}><h1 className='cart'><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" id="IconChangeColor" height="68" width="68"><rect width="156" height="156" fill="none"></rect><circle cx="80" cy="216" r="12"></circle><circle cx="184" cy="216" r="12"></circle><path d="M42.3,72H221.7l-26.4,92.4A15.9,15.9,0,0,1,179.9,176H84.1a15.9,15.9,0,0,1-15.4-11.6L32.5,37.8A8,8,0,0,0,24.8,32H8" fill="none" stroke="#faf9f9" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" id="mainIconPathAttribute"></path><text x="50%" y="50%" textAnchor="middle" fill="white" fontSize="60" dy=".3em"> {totalItemsCart()} </text></svg></h1></a></div>
</div>
</div>
{!showCart? (