Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 48 additions & 46 deletions app/contact/contact-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,16 @@ export function ContactLink({ url, display, easterEgg }: ContactLinkProps) {
const keyframes = generateRandomKeyframes()
const css = `@keyframes ${animationId} { ${keyframes} }`

// Remove old style element if it exists
if (styleRef.current) {
styleRef.current.remove()
}

// Create new style element each time
styleRef.current = document.createElement("style")
styleRef.current.textContent = css
document.head.appendChild(styleRef.current)
}

return () => {
// Cleanup on unmount
if (styleRef.current) {
styleRef.current.remove()
styleRef.current = null
Expand All @@ -65,6 +62,7 @@ export function ContactLink({ url, display, easterEgg }: ContactLinkProps) {
<div
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
className="min-h-[3rem]"
>
<div className="flex items-center gap-2">
<span className="text-accent/60">$</span>
Expand All @@ -78,51 +76,55 @@ export function ContactLink({ url, display, easterEgg }: ContactLinkProps) {
<span className="ml-2 group-hover:underline">{display}</span>
</Link>
</div>
<AnimatePresence>
{isHovered && easterEgg && (
<motion.div
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: "auto" }}
exit={{ opacity: 0, height: 0 }}
transition={{ duration: 0.2 }}
className="overflow-hidden"
>
<Link
href={url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2 py-1 text-muted-foreground/70 text-xs font-mono"
>
<span>#</span>
<span className="flex items-center">
<motion.span
initial={{ width: 0 }}
animate={{ width: "auto" }}
transition={{
duration: 0.6,
ease: "linear",
}}
className="inline-block overflow-hidden whitespace-nowrap"
style={{
animation: isHovered && easterEgg ? `${animationIdRef.current} 0.6s linear forwards` : "none",
}}
<div className="h-6 overflow-hidden">
{easterEgg && (
<AnimatePresence>
{isHovered && (
<motion.div
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: "auto" }}
exit={{ opacity: 0, height: 0 }}
transition={{ duration: 0.2 }}
className="overflow-hidden"
>
<Link
href={url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2 py-1 text-muted-foreground/70 text-xs font-mono"
>
{easterEgg}
</motion.span>
<motion.span
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{
duration: 0.1,
delay: 0.1,
}}
className="cursor-block"
/>
</span>
</Link>
</motion.div>
<span>#</span>
<span className="flex items-center">
<motion.span
initial={{ width: 0 }}
animate={{ width: "auto" }}
transition={{
duration: 0.6,
ease: "linear",
}}
className="inline-block overflow-hidden whitespace-nowrap"
style={{
animation: isHovered && easterEgg ? `${animationIdRef.current} 0.6s linear forwards` : "none",
}}
>
{easterEgg}
</motion.span>
<motion.span
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{
duration: 0.1,
delay: 0.1,
}}
className="cursor-block"
/>
</span>
</Link>
</motion.div>
)}
</AnimatePresence>
)}
</AnimatePresence>
</div>
</div>
)
}
6 changes: 3 additions & 3 deletions app/contact/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const contactLinks = [
{
url: "mailto:jakebodea@gmail.com",
display: "jakebodea@gmail.com",
easterEgg: "no spam pls"
easterEgg: "pls no spam thanks"
},
{
url: "https://x.com/jakebodea",
Expand All @@ -16,12 +16,12 @@ const contactLinks = [
{
url: "https://www.linkedin.com/in/jakebodea/",
display: "linkedin.com/in/jakebodea",
easterEgg: "unfortunately i still need this platform"
easterEgg: "unfortunately"
},
{
url: "https://github.com/jakebodea",
display: "github.com/jakebodea",
easterEgg: "don't DM me here but check out my commit history map"
easterEgg: "check out my commit history map"
}
]

Expand Down