This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useRef } from "react"; | |
const useListener = (outsideFunction) => { | |
const ref = useRef(); | |
useEffect(() => { | |
const handleClick = (event) => { | |
if (ref.current && ref.current.contains(event.target)) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import useListener from "../../hooks/useListener"; | |
import styled from "styled-components"; | |
const DropdownContainer = styled.div` | |
width: 100px; | |
height: 100%; | |
position: relative; | |
display: flex; | |
align-items: center; |