-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display a popover when hovering over highlighted mentions
- Loading branch information
Showing
6 changed files
with
170 additions
and
10 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { Mention } from '../../../types/api'; | ||
import type { InvalidUsername } from '../../helpers/mentions'; | ||
|
||
export type MentionPreviewContent = { | ||
content: Mention | InvalidUsername; | ||
}; | ||
|
||
/** | ||
* Information to display on a Popover when hovering over a processed mention | ||
*/ | ||
export default function MentionPreviewContent({ | ||
content, | ||
}: MentionPreviewContent) { | ||
if (typeof content === 'string') { | ||
return ( | ||
<> | ||
No user with username <span className="font-bold">{content}</span>{' '} | ||
exists | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col gap-y-1.5"> | ||
<div className="text-md font-bold">@{content.username}</div> | ||
{content.display_name && ( | ||
<div className="text-color-text-light">{content.display_name}</div> | ||
)} | ||
</div> | ||
); | ||
} |
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