@@ -2,7 +2,7 @@ import React from 'react';
2
2
import PropTypes from 'prop-types' ;
3
3
import { safeClick } from '../utils/event-handlers' ;
4
4
5
- export function ListGroupItem ( { index, isActive, children , linked , isDisabled , onSelect } ) {
5
+ export function ListGroupItem ( { index, isActive, isDisabled , item , linked , onSelect, children } ) {
6
6
const classes = [
7
7
'list-group-item' ,
8
8
isActive && 'active' ,
@@ -12,16 +12,18 @@ export function ListGroupItem({ index, isActive, children, linked, isDisabled, o
12
12
. filter ( ( v ) => v )
13
13
. join ( ' ' ) ;
14
14
15
+ const onClick = safeClick ( onSelect , index , item ) ;
16
+
15
17
if ( linked ) {
16
18
return (
17
- < a href = "#" className = { classes } onClick = { safeClick ( onSelect , index ) } >
19
+ < a href = "#" className = { classes } onClick = { onClick } >
18
20
{ children }
19
21
</ a >
20
22
) ;
21
23
}
22
24
23
25
return (
24
- < li className = { classes } onClick = { safeClick ( onSelect , index ) } >
26
+ < li className = { classes } onClick = { onClick } >
25
27
{ children }
26
28
</ li >
27
29
) ;
@@ -36,6 +38,7 @@ ListGroupItem.propTypes = {
36
38
index : PropTypes . number . isRequired ,
37
39
isActive : PropTypes . bool ,
38
40
isDisabled : PropTypes . bool ,
41
+ item : PropTypes . object . isRequired ,
39
42
linked : PropTypes . bool . isRequired ,
40
43
onSelect : PropTypes . func ,
41
44
} ;
0 commit comments