This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
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.
feat: minimap svgs show contact info on hover
- Loading branch information
Showing
4 changed files
with
117 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from "react" | ||
import * as HoverCard from "@radix-ui/react-hover-card" | ||
|
||
interface HoverCardItemProps { | ||
image?: string | ||
alt?: string | ||
title: string | ||
content: string | React.ReactNode | ||
footer?: string | React.ReactNode | ||
children: React.ReactNode | ||
} | ||
|
||
const HoverCardItem: React.FC<HoverCardItemProps> = ({ | ||
children, | ||
alt, | ||
title, | ||
content, | ||
footer, | ||
image, | ||
}) => { | ||
return ( | ||
<HoverCard.Root openDelay={2}> | ||
<HoverCard.Trigger asChild> | ||
<a className="cursor-pointer" rel="noreferrer noopener"> | ||
{children} | ||
</a> | ||
</HoverCard.Trigger> | ||
<HoverCard.Portal> | ||
<HoverCard.Content sideOffset={5}> | ||
<div className="bg-white p-5 rounded shadow flex flex-col gap-3.5"> | ||
{image && alt && <img className="w-14 h-14 rounded-full" src={image} alt={alt} />} | ||
<div className="flex flex-col gap-3.5"> | ||
<p className="font-semibold">{title}</p> | ||
<div>{content}</div> | ||
{footer && ( | ||
<div className="flex gap-3.5"> | ||
<p>{footer}</p> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
<HoverCard.Arrow className="fill-white" /> | ||
</HoverCard.Content> | ||
</HoverCard.Portal> | ||
</HoverCard.Root> | ||
) | ||
} | ||
|
||
export default HoverCardItem |
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
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