Skip to content

Commit

Permalink
fixed product add and delete
Browse files Browse the repository at this point in the history
  • Loading branch information
FacuEM committed Feb 24, 2021
1 parent a01f17e commit 4c0dfb1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
20 changes: 16 additions & 4 deletions src/components/Directory/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React from "react";
import { Link } from "react-router-dom";

import ShopMen from "./../../assets/shopMens.jpg";
import ShopWomen from "./../../assets/shopWomens.jpg";
import "./styles.scss";
Expand All @@ -7,11 +9,21 @@ const Directory = () => {
return (
<div className="directory">
<div className="wrap">
<div className="item" style={{ backgroundImage: `url(${ShopMen})` }}>
<a>Shop Mens</a>
<div
className="item"
style={{
backgroundImage: `url(${ShopWomen})`,
}}
>
<Link to="/search/womens">Shop Womens</Link>
</div>
<div className="item" style={{ backgroundImage: `url(${ShopWomen})` }}>
<a>Shop Womens</a>
<div
className="item"
style={{
backgroundImage: `url(${ShopMen})`,
}}
>
<Link to="/search/mens">Shop Mens</Link>
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/components/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import "./styles.scss";
const Modal = ({ hideModal, toggleModal, children }) => {
if (hideModal) return null;

return (
<>
<div className="modalOverlay" onClick={() => toggleModal()} />{" "}
return [
<div className="modalOverlay" onClick={() => toggleModal()} />,
<div className="modalWrap">
<div className="modal">{children}</div>
</>
);
</div>,
];
};

export default Modal;
1 change: 1 addition & 0 deletions src/pages/Admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
fetchProductsStart,
deleteProductStart,
} from "./../../redux/Product/products.action";

import Modal from "./../../components/Modal";
import FormInput from "./../../components/forms/FormInput";
import FormSelect from "./../../components/forms/FormSelect";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Homepage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import Directory from "../../components/Directory";
import "./styles.scss";

const Homepage = (props) => {
const Homepage = () => {
return (
<section className="homepage">
<Directory />
Expand Down
13 changes: 10 additions & 3 deletions src/redux/Product/products.reducers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import productsTypes from "./products.types";
import productTypes from "./products.types";

const INITIAL_STATE = {
products: [],
Expand All @@ -7,10 +8,16 @@ const INITIAL_STATE = {

const productsReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case productsTypes.SET_PRODUCTS:
return { ...state, products: action.payload };
case productTypes.SET_PRODUCTS:
return {
...state,
products: action.payload,
};
case productsTypes.SET_PRODUCT:
return { ...state, product: action.payload };
return {
...state,
product: action.payload,
};
default:
return state;
}
Expand Down

0 comments on commit 4c0dfb1

Please sign in to comment.