@@ -22,7 +22,9 @@ const Applications = () => {
2222 const [ open , setOpen ] = useState < boolean > ( false ) ;
2323 const [ index , setIndex ] = useState < number > ( 0 ) ;
2424 const [ app , setApp ] = useState < string > ( '' ) ;
25- const delRef = useRef < any > ( null ) ;
25+
26+ // Dynamic refs
27+ const delRef = useRef < any > ( [ ] ) ;
2628
2729 useEffect ( ( ) => {
2830 getApplications ( ) ;
@@ -36,7 +38,7 @@ const Applications = () => {
3638
3739 // Handle clicks on Application cards
3840 const handleClick = ( event : ClickEvent , selectedApp : string , i : number ) => {
39- if ( ! delRef . current . contains ( event . target ) ) {
41+ if ( delRef . current [ i ] && ! delRef . current [ i ] . contains ( event . target ) ) {
4042 setIndex ( i ) ;
4143 setApp ( selectedApp ) ;
4244 setOpen ( true ) ;
@@ -52,7 +54,10 @@ const Applications = () => {
5254 backgroundColor : 'rgba(33, 34, 41, 0.2)' ,
5355 border : '3px ridge #808080' ,
5456 boxShadow : '0 10px 10px rgba(0,0,0,0.5)' ,
55- '&:hover, &.Mui-focusVisible' : { color : 'white' , background : 'rgba(33, 34, 41, 1.2)' } ,
57+ '&:hover, &.Mui-focusVisible' : {
58+ color : 'white' ,
59+ background : 'rgba(33, 34, 41, 1.2)' ,
60+ } ,
5661 } ,
5762 hover : {
5863 position : 'relative' ,
@@ -91,7 +96,7 @@ const Applications = () => {
9196 < CardHeader
9297 avatar = {
9398 < IconButton
94- ref = { delRef }
99+ ref = { element => ( delRef . current [ i ] = element ) }
95100 className = { classes . hover }
96101 aria-label = "Delete"
97102 onClick = { event => confirmDelete ( event , app [ 0 ] , i ) }
@@ -115,8 +120,3 @@ const Applications = () => {
115120} ;
116121
117122export default Applications ;
118-
119- //name, desc, creation date
120- // three cards a row, same width
121- // move trash can
122- //change the font
0 commit comments