diff --git a/src/components/pages/Exercise01/index.js b/src/components/pages/Exercise01/index.js
index b36b04f..3e30ef9 100644
--- a/src/components/pages/Exercise01/index.js
+++ b/src/components/pages/Exercise01/index.js
@@ -1,20 +1,112 @@
/**
* Exercise 01: The Retro Movie Store
* Implement a shopping cart with the next features for the Movie Store that is selling retro dvds:
- * 1. Add a movie to the cart
- * 2. Increment or decrement the quantity of movie copies. If quantity is equal to 0, the movie must be removed from the cart
- * 3. Calculate and show the total cost of your cart. Ex: Total: $150
+ * 1. Add a movie to the cart [done]
+ * 2. Increment or decrement the quantity of movie copies. If quantity is equal to 0, the movie must be removed from the cart [done]
+ * 3. Calculate and show the total cost of your cart. Ex: Total: $150 [done]
* 4. Apply discount rules. You have an array of offers with discounts depending of the combination of movie you have in your cart.
* You have to apply all discounts in the rules array (discountRules).
- * Ex: If m: [1, 2, 3], it means the discount will be applied to the total when the cart has all that products in only.
+ * Ex: If m: [1, 2, 3], it means the discount will be applied to the total when the cart has all that products in only.[done]
*
* You can modify all the code, this component isn't well designed intentionally. You can redesign it as you need.
*/
import './assets/styles.css'
-import { useState } from 'react'
+import { useState, createContext, useContext } from 'react'
-export default function Exercise01 () {
+const Context = createContext()
+
+const SingleMovie = (props) => {
+ const { movieInfo } = props
+ const { setCart, cart } = useContext(Context)
+ const handleAddToCart = () => {
+
+ const cartIdExist = () => {
+ let exist = false
+ for (let i = 0; i < cart.length; i++) {
+ const item = cart[i];
+ if (item.id === movieInfo.id) {
+ exist = true
+ break
+ }
+ }
+ return exist
+ }
+ if (cartIdExist()) {
+ return
+ }
+ movieInfo.quantity = 1
+ const cartCopy = [...cart]
+ cartCopy.push(movieInfo)
+ setCart(cartCopy)
+ }
+ return (
+