diff --git a/src/components/generic/DropdownWithPopup.js b/src/components/generic/DropdownWithPopup.js index cca1014..ddad43a 100644 --- a/src/components/generic/DropdownWithPopup.js +++ b/src/components/generic/DropdownWithPopup.js @@ -4,10 +4,29 @@ import { Medium } from '../../utils/fonts'; import theme from '../../utils/theme'; import ImageButton from './ImageButton'; import pencilIco from '../../assets/pencil_ico.svg'; +import styled from 'styled-components'; +import PopUp from './PopUp'; +import { createPortal } from 'react-dom'; + +const DropdownWithPopupStyle = styled(FlexColumn)` + cursor: pointer; + gap: 8px; + width: 100%; + align-items: flex-start; + * { + cursor: pointer; + } +`; const DropdownWithPopup = (props) => { + const [tagsPopUp, setTagsPopUp] = React.useState(false); + return ( - + { + if (!tagsPopUp) setTagsPopUp(true); + }} + > {props.label} @@ -29,7 +48,12 @@ const DropdownWithPopup = (props) => { - + {tagsPopUp && + createPortal( + setTagsPopUp(false)}>, + document.body + )} + ); }; diff --git a/src/components/generic/ImageButton.js b/src/components/generic/ImageButton.js index 91ca906..fd02d9e 100644 --- a/src/components/generic/ImageButton.js +++ b/src/components/generic/ImageButton.js @@ -5,6 +5,9 @@ const ImageButtonStyle = styled(FlexRow)` cursor: pointer; transition: transform ease-in-out 0.3s; transform: rotate(${({ rotate }) => (rotate ? rotate : '0')}); + * { + cursor: pointer; + } &:hover { transform: rotate(${({ rotate }) => (rotate ? rotate : '0')}), scale(1.2); } diff --git a/src/components/generic/PopUp.js b/src/components/generic/PopUp.js new file mode 100644 index 0000000..b57ad14 --- /dev/null +++ b/src/components/generic/PopUp.js @@ -0,0 +1,48 @@ +import React from 'react'; +import { FlexColumn } from '../../utils/containers'; +import styled from 'styled-components'; + +const PopUpStyle = styled(FlexColumn)` + position: fixed; + top: 0; + left: 0; + z-index: 100; + width: 100%; + height: 100vh; + background-color: ${({ theme }) => theme.colors.dark01}; + + .PopUpStyle__body { + width: ${({ width }) => (width ? width : '60%')}; + min-height: ${({ minHeight }) => (minHeight ? minHeight : '50%')}; + padding: ${({ padding }) => (padding ? padding : '48px')}; + border-radius: 12px; + background-color: ${({ theme }) => theme.colors.white}; + } +`; + +const PopUp = (props) => { + const [onHover, setOnHover] = React.useState(false); + + const closePopUp = () => { + if (!onHover) props.closeHandler(); + }; + + return ( + + setOnHover(true)} + onMouseLeave={() => setOnHover(false)} + className="PopUpStyle__body" + > + {props.children} + + + ); +}; + +export default PopUp;