userHoverIn = () => {
this.setState({
onHoverUser: true
})
};
userHoverOut = () => {
this.setState({
onHoverUser: false
})
};
return (
<div
onMouseOver={this.userHoverIn}
onMouseOut={this.userHoverOut}
className="top-menu__user">
<img className="user-icon" src="/img/logo.jpg" alt=""/>
<span>{user}</span>
<Link className={this.state.onHoverUser ? "user-logout" : "user-logout hide"} to="/">
<MdExitToApp className="icon"/>
Logout
</Link>
<div className="icon"><MdArrowDropDown/></div>
</div>
);
.top-menu__user {
display: flex;
align-items: center;
position: relative;
}
.user-logout {
position: absolute;
bottom: -25px;
justify-content: center;
align-items: center;
width: 100%;
color: $orange;
display: flex;
&.hide {
display: none;
}
.icon {
font-size: 20px;
margin-right: 5px;
}
}
.user-logout {
border-top: 5px solid transparent;
background-clip: padding-box;
}