import React, { useEffect, useRef, useState } from "react"; import './avatars.css'; import Profile from '../../../assets/images/user-7.jpg'; import Iconsvg from '../../Ui/Icon/Icon' type Props = { name: string, designation: string, size? : 'default' | 'small' | 'medium' | 'large', borderRadius?: string } const Avatars = (props:Props) => { const {name, designation, size, borderRadius } = props; const style = { borderRadius: borderRadius ? borderRadius : '0' } const [show, setShow] = useState(false); const dropdownRef = useRef(null); const showMenu = () => { setShow(!show) }; useEffect(() => { const pageClickEvent = (e:any) => { if (dropdownRef.current !== null && !dropdownRef.current.contains(e.target)) { setShow(!show); } }; if (show) { window.addEventListener('click', pageClickEvent); } return () => { window.removeEventListener('click', pageClickEvent); } }, [show]) return ( <>
Welcome
  • My Account
  • Settings
  • Lock Screen
  • Log out
); }; export default Avatars;