diff --git a/src/components/Navbar/index.js b/src/components/Navbar/index.js index 5a78109..4eeeb9d 100644 --- a/src/components/Navbar/index.js +++ b/src/components/Navbar/index.js @@ -4,6 +4,8 @@ import { useLocation, NavLink } from "react-router-dom"; import { devLogo, wishlist, cart, burger, User } from "../../assets"; import { useAuth } from "../../Context/auth/auth-context"; +import Tooltip from "../Tooltip/Tooltip"; + import SidebarNav from "./SidebarNav"; const Navbar = () => { @@ -49,9 +51,11 @@ const Navbar = () => { {!pathArray.some((item) => currentPath.pathname === item) && (
{token ? ( - - userImage - + + + userImage + + ) : ( <> @@ -67,14 +71,18 @@ const Navbar = () => {
- + + + - + + +
diff --git a/src/components/Tooltip/Shape.js b/src/components/Tooltip/Shape.js new file mode 100644 index 0000000..6edec3e --- /dev/null +++ b/src/components/Tooltip/Shape.js @@ -0,0 +1,9 @@ +const Shape = (props) => { + return ( +
+
+
{props.children}
+
+ ); +}; +export default Shape; diff --git a/src/components/Tooltip/Tooltip.js b/src/components/Tooltip/Tooltip.js new file mode 100644 index 0000000..88dbab8 --- /dev/null +++ b/src/components/Tooltip/Tooltip.js @@ -0,0 +1,21 @@ +import { useState } from "react"; + +import "./tooltip.css"; +import Shape from "./Shape"; +const Tooltip = (props) => { + const [show, setShow] = useState(false); + const onMouseHover = () => setShow(true); + const onMouseLeave = () => setShow(false); + + return ( +
+ {props.children} + {show && {props.info}} +
+ ); +}; + +export default Tooltip; diff --git a/src/components/Tooltip/tooltip.css b/src/components/Tooltip/tooltip.css new file mode 100644 index 0000000..a4b53d2 --- /dev/null +++ b/src/components/Tooltip/tooltip.css @@ -0,0 +1,14 @@ +.shape { + position: absolute; + width: 100%; +} +.tooltip-text { + background-color: #575757; + padding: 8px 10px; + border-radius: 4px; + color: white; + font-size: 12px; +} +.tooltip-content { + position: relative; +}