-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from CalcagnoLoic/develop
Adding HOC for basket
- Loading branch information
Showing
18 changed files
with
123 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# e-commerce | ||
# Sneakers Company E-Commerce | ||
|
||
![](public/assets/img/readme.jpg) | ||
![](public/assets/img/readme.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import BasketIcons from "../../Icons/BasketIcons"; | ||
import Button from "./index"; | ||
|
||
const meta = { | ||
title: "Components/Button", | ||
component: Button, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const AddToCart: Story = { | ||
args: { | ||
onClick: () => {}, | ||
content: "Add To Cart", | ||
icon: <BasketIcons color="light" css="icon-to-cart mr-5" />, | ||
css: "button-wrapper", | ||
}, | ||
}; | ||
|
||
export const Checkout: Story = { | ||
args: { | ||
content: "Checkout", | ||
css: "button-basket", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { useBasketContext } from "../../hooks/useBasketContext"; | ||
import { useState } from "react"; | ||
|
||
import BasketIcons from "../../Icons/BasketIcons"; | ||
import Button from "../../components/Button"; | ||
import Counter from "../../components/Counter"; | ||
|
||
const Component = () => { | ||
const [quantity, setQuantity] = useState<number>(0); | ||
const { addToCart } = useBasketContext(); | ||
|
||
const handleCounter = (kind: string) => { | ||
if (kind === "add") { | ||
setQuantity(quantity + 1); | ||
} else { | ||
setQuantity(quantity - 1); | ||
} | ||
}; | ||
|
||
const handleSubmit = () => { | ||
if (quantity >= 0) { | ||
addToCart(quantity); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="mt-8 flex flex-col lg:flex-row"> | ||
<Counter onClick={handleCounter} quantity={quantity} /> | ||
<Button | ||
onClick={handleSubmit} | ||
content="Add To Cart" | ||
icon={<BasketIcons color="light" css="icon-to-cart mr-5" />} | ||
css="button-wrapper" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Component; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.