@@ -29,6 +29,10 @@ const nodeChildFill = '#62d6fb'; //#62d6fb original
2929const nodeParentStroke = '#F00008' ; //#F00008 original
3030const nodeChildStroke = '#4D4D4D' ; //#4D4D4D original
3131let stroke = '' ;
32+ //css class for hovered stroke change
33+ const hoverClass = {
34+ stroke : '#ab269b' //pinkish
35+ }
3236
3337
3438const defaultMargin : DefaultMargin = {
@@ -233,6 +237,7 @@ export default function ComponentMap({
233237 const linkName = link . source . data . name ;
234238 const propsObj = link . source . data . componentData . props ;
235239 const childPropsObj = link . target . data . componentData . props ;
240+ //consolelog const above
236241 let propsLength ;
237242 let childPropsLength ;
238243 console . log ( `------------------------------${ i } :` ) ;
@@ -265,15 +270,31 @@ export default function ComponentMap({
265270 stroke = '#df6f37'
266271 }
267272
273+ //testing hover functionality
274+ const [ isHovered , setIsHovered ] = React . useState ( false ) ;
275+
276+ //hover state
277+ const [ isHovered , setIsHovered ] = useState ( false ) ;
278+ const handleMouseEnter = ( ) => {
279+ setIsHovered ( true ) ;
280+ } ;
281+ const handleMouseLeave = ( ) => {
282+ setIsHovered ( false ) ;
283+ } ;
284+ const strokeColor = isHovered ? hoverClass . stroke : stroke ;
285+
268286 return (
269287 < LinkComponent
270288 className = 'compMapLink'
271289 key = { i }
272290 data = { link }
273291 percent = { stepPercent }
274- stroke = { stroke } // color of the link --not used--
292+ stroke = { strokeColor } // changint this color on hover
275293 strokeWidth = { strokeWidthIndex } /* strokeWidth */ // width of the link
276294 fill = 'none'
295+ //testing hover functionality
296+ onMouseEnter = { handleMouseEnter }
297+ onMouseLeave = { handleMouseLeave }
277298 />
278299 )
279300 } )
0 commit comments