This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1869 from yjyoo773/PORTALS-2382
PORTALS-2382: tag user or team in markdown editor
- Loading branch information
Showing
2 changed files
with
80 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
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,43 @@ | ||
import React, { useCallback } from 'react' | ||
import { Modal } from 'react-bootstrap' | ||
import { TYPE_FILTER, UserGroupHeader } from '../../utils/synapseTypes' | ||
import UserSearchBoxV2 from '../UserSearchBoxV2' | ||
|
||
export type UserMentionModalProps = { | ||
show: boolean | ||
onClose: () => void | ||
handleUserTag: (user: string) => void | ||
} | ||
|
||
export const UserMentionModal: React.FC<UserMentionModalProps> = ({ | ||
show, | ||
onClose, | ||
handleUserTag, | ||
}: UserMentionModalProps) => { | ||
const onUserChange = useCallback( | ||
(selected: string | null, header: UserGroupHeader | null) => { | ||
if (selected && header) { | ||
handleUserTag(header.userName) | ||
} | ||
onClose() | ||
}, | ||
[onClose, handleUserTag], | ||
) | ||
|
||
return ( | ||
<> | ||
<Modal show={show} onHide={onClose} backdrop="static" animation={false}> | ||
<Modal.Header closeButton> | ||
<Modal.Title>Find User or Team</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body> | ||
<UserSearchBoxV2 | ||
placeholder="Search for a user or team name" | ||
onChange={onUserChange} | ||
typeFilter={TYPE_FILTER.USERS_ONLY} | ||
/> | ||
</Modal.Body> | ||
</Modal> | ||
</> | ||
) | ||
} |