Skip to content

Commit 4dce894

Browse files
stoke hover functionality
1 parent 87d24a7 commit 4dce894

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/app/components/StateRoute/ComponentMap/ComponentMap.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const nodeChildFill = '#62d6fb'; //#62d6fb original
2929
const nodeParentStroke = '#F00008'; //#F00008 original
3030
const nodeChildStroke = '#4D4D4D'; //#4D4D4D original
3131
let stroke = '';
32+
//css class for hovered stroke change
33+
const hoverClass = {
34+
stroke: '#ab269b' //pinkish
35+
}
3236

3337

3438
const 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
})

src/app/styles/components/_componentMap.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
// //stroke: $map-parent-stroke;
2323
// }
2424

25+
//Jose testing onhover
26+
.compMapParent:hover {
27+
stroke: color(red)
28+
}
29+
2530
.compMapParentText {
2631
fill: $map-parent-text
2732
}

0 commit comments

Comments
 (0)