diff --git a/src/components/Corner-popup/index.js b/src/components/Corner-popup/index.js index 0a77b25560b5c..35fb59d17206c 100644 --- a/src/components/Corner-popup/index.js +++ b/src/components/Corner-popup/index.js @@ -1,20 +1,21 @@ import React, { useState, useEffect } from "react"; import Button from "../../reusecore/Button"; import { ReactComponent as CloseIcon } from "./closeIcon.svg"; -import popupImageSmall from "./power-of-meshery-small.webp"; import CornerPopupWrapper from "./popup.style"; -const CornerPopup = () => { +const CornerPopup = ({ storageKey = "showPopup", link, text, content }) => { const [showPopup, setShowPopup] = useState(false); useEffect(() => { - if (!localStorage.getItem("showPopup")) { + if (!localStorage.getItem(storageKey)) { setTimeout(() => { setShowPopup(true); + localStorage.setItem(storageKey, true); }, 8000); - localStorage.setItem("showPopup", true); - } else setShowPopup(false); - },[]); + } else { + setShowPopup(false); + } + }, [storageKey]); return ( showPopup && @@ -25,10 +26,10 @@ const CornerPopup = () => {
setShowPopup(false)}>
- - + + {content} -