@@ -5,6 +5,8 @@ import axios from 'axios';
55import Autocomplete from '@material-ui/lab/Autocomplete' ;
66import TextField from '@material-ui/core/TextField' ;
77import CircularProgress from '@material-ui/core/CircularProgress' ;
8+ import Tooltip from '@material-ui/core/Tooltip' ;
9+ import { withStyles } from '@material-ui/core' ;
810
911import AlertContext from '~/context/alert' ;
1012import BiolinkContext from '~/context/biolink' ;
@@ -204,6 +206,7 @@ export default function NodeSelector({
204206 onOpen = { ( ) => toggleOpen ( true ) }
205207 onClose = { ( ) => toggleOpen ( false ) }
206208 onInputChange = { ( e , v ) => updateInputText ( v ) }
209+ renderOption = { ( props ) => < Option { ...props } /> }
207210 renderInput = { ( params ) => (
208211 < TextField
209212 { ...params }
@@ -237,3 +240,33 @@ export default function NodeSelector({
237240 />
238241 ) ;
239242}
243+
244+ const CustomTooltip = withStyles ( ( theme ) => ( {
245+ tooltip : {
246+ fontSize : theme . typography . pxToRem ( 14 ) ,
247+ } ,
248+ } ) ) ( Tooltip ) ;
249+
250+ function Option ( { name, ids, categories } ) {
251+ return (
252+ < CustomTooltip
253+ interactive
254+ arrow
255+ title = { (
256+ < div className = "node-option-tooltip-wrapper" >
257+ { Array . isArray ( ids ) && ids . length > 0 && (
258+ < span > { ids [ 0 ] } </ span >
259+ ) }
260+ { Array . isArray ( categories ) && categories . length > 0 && (
261+ < span > { categories [ 0 ] } </ span >
262+ ) }
263+ </ div >
264+ ) }
265+ placement = "left"
266+ >
267+ < div >
268+ { name }
269+ </ div >
270+ </ CustomTooltip >
271+ ) ;
272+ }
0 commit comments