diff --git a/src/components/Popup/index.jsx b/src/components/Popup/index.jsx new file mode 100644 index 0000000..3186f4c --- /dev/null +++ b/src/components/Popup/index.jsx @@ -0,0 +1,38 @@ +import React, { useState } from "react"; +import { usePopper } from "react-popper"; +import PT from "prop-types"; +import cn from "classnames"; +import compStyles from "./styles.module.scss"; + +const Popup = ({ children, className, referenceElement }) => { + const [popperElement, setPopperElement] = useState(null); + const [arrowElement, setArrowElement] = useState(null); + const { styles, attributes } = usePopper(referenceElement, popperElement, { + placement: "bottom", + modifiers: [ + { name: "arrow", options: { element: arrowElement, padding: 10 } }, + { name: "offset", options: { offset: [0, 5] } }, + { name: "preventOverflow", options: { padding: 15 } }, + ], + }); + + return ( +