-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f32037
commit ff97760
Showing
4 changed files
with
101 additions
and
101 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import Image from "next/image"; | ||
import Tooltip from "./Tooltip"; | ||
|
||
import squ from "public/profile_img/squ.jpg"; | ||
|
||
const StaffCard = () => { | ||
return ( | ||
<div className="flex flex-col col-span-1 justify-center bg-white p-4 rounded-lg shadow-md w-60"> | ||
<div> | ||
<Image | ||
src={squ} | ||
alt="Profile Image" | ||
className="w-60 h-60 rounded-md mb-2" | ||
width={60} | ||
height={60} | ||
/> | ||
</div> | ||
<div> | ||
<h3 className="text-lg font-semibold">Squirrel Snow</h3> | ||
<h4 className="text-gray-700 text-md">She/Her</h4> | ||
<hr className="border-gray-700 my-2" /> | ||
</div> | ||
<div className="flex items-center justify-around space-x-2"> | ||
<Tooltip text="Loves painting"> | ||
<span | ||
role="img" | ||
aria-label="hobby1" | ||
className="text-2xl cursor-pointer" | ||
> | ||
π¨ | ||
</span> | ||
</Tooltip> | ||
<Tooltip text="Avid reader"> | ||
<span | ||
role="img" | ||
aria-label="hobby2" | ||
className="text-2xl cursor-pointer" | ||
> | ||
π | ||
</span> | ||
</Tooltip> | ||
<Tooltip text="Enjoys running"> | ||
<span | ||
role="img" | ||
aria-label="hobby3" | ||
className="text-2xl cursor-pointer" | ||
> | ||
πββοΈ | ||
</span> | ||
</Tooltip> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default StaffCard; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
const Tooltip = ({ text, children }) => { | ||
const [showTooltip, setShowTooltip] = useState(false); | ||
const [hoverTimeout, setHoverTimeout] = useState(null); | ||
|
||
const handleMouseEnter = () => { | ||
const timeout = setTimeout(() => { | ||
setShowTooltip(true); | ||
}, 1000); // 1 second | ||
setHoverTimeout(timeout); | ||
}; | ||
|
||
const handleMouseLeave = () => { | ||
clearTimeout(hoverTimeout); | ||
setShowTooltip(false); | ||
}; | ||
|
||
return ( | ||
<div | ||
className="relative inline-block" | ||
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} | ||
> | ||
{children} | ||
{showTooltip && ( | ||
<div className="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 w-32 bg-black text-white text-center text-sm rounded py-1 px-2 "> | ||
{text} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Tooltip; |
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