Skip to content

Instantly share code, notes, and snippets.

@SafaElmali
Last active September 18, 2021 18:05
Show Gist options
  • Save SafaElmali/6bf158b285edbead4791ee1b7109f4a5 to your computer and use it in GitHub Desktop.
Save SafaElmali/6bf158b285edbead4791ee1b7109f4a5 to your computer and use it in GitHub Desktop.
import "../styles/productDetail.css";
import { useState } from "react";
import ModalWithPortal from "./ModalWithPortal";
import ModalWithoutPortal from "./ModalWithoutPortal";
const ProductDetail = () => {
const [isOpen, setIsOpen] = useState(false);
const [isOpenPortal, setIsOpenPortal] = useState(false);
const handleOpen = () => {
setIsOpen(true);
};
const handleOpenPortal = () => {
setIsOpenPortal(true);
};
return (
<div className="product-container">
....
<div className="product-button-container">
<button className="add-to-basket-button" onClick={handleOpenPortal}>
Sepete Ekle (Portal)
</button>
<button className="add-to-basket-button" onClick={handleOpen}>
Sepete Ekle (Portalsız)
</button>
</div>
</div>
<ModalWithPortal
isOpenPortal={isOpenPortal}
setIsOpenPortal={setIsOpenPortal}
productName={"Pubg"}
/>
<ModalWithoutPortal
isOpen={isOpen}
setIsOpen={setIsOpen}
productName={"Pubg"}
/>
</div>
);
};
export default ProductDetail;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment