@@ -13,7 +13,7 @@ import { SelectedItemsContext } from '../../universal.discovery.module';
13
13
14
14
import { REMOVE_SELECTED_ITEMS } from '../../hooks/useSelectedItemsReducer' ;
15
15
16
- const SelectedItemsPanelItem = ( { item, thumbnailData, name, description } ) => {
16
+ const SelectedItemsPanelItem = ( { item, thumbnailData, name, description, extraContent } ) => {
17
17
const adminUiConfig = getAdminUiConfig ( ) ;
18
18
const Translator = getTranslator ( ) ;
19
19
const refSelectedLocationsItem = useRef ( null ) ;
@@ -25,7 +25,7 @@ const SelectedItemsPanelItem = ({ item, thumbnailData, name, description }) => {
25
25
) ;
26
26
const removeFromSelection = ( ) => {
27
27
hideAllTooltips ( refSelectedLocationsItem . current ) ;
28
- dispatchSelectedItemsAction ( { type : REMOVE_SELECTED_ITEMS , ids : [ { id : item . id , type : item . type } ] } ) ;
28
+ dispatchSelectedItemsAction ( { type : REMOVE_SELECTED_ITEMS , itemsIdsWithTypes : [ { id : item . id , type : item . type } ] } ) ;
29
29
} ;
30
30
const sortedActions = useMemo ( ( ) => {
31
31
const { universalSelectItemActions } = adminUiConfig . universalDiscoveryWidget ;
@@ -44,29 +44,32 @@ const SelectedItemsPanelItem = ({ item, thumbnailData, name, description }) => {
44
44
parseTooltip ( node ) ;
45
45
} }
46
46
>
47
- < div className = "c-selected-items-panel-item__image-wrapper" >
48
- < Thumbnail thumbnailData = { thumbnailData } iconExtraClasses = "ibexa-icon--small" />
49
- </ div >
50
- < div className = "c-selected-items-panel-item__info" >
51
- < span className = "c-selected-items-panel-item__info-name" > { name } </ span >
52
- < span className = "c-selected-items-panel-item__info-description" > { description } </ span >
53
- </ div >
54
- < div className = "c-selected-items-panel-item__actions-wrapper" >
55
- { sortedActions . map ( ( action ) => {
56
- const Component = action . component ;
47
+ < div className = "c-selected-items-panel-item__main-content" >
48
+ < div className = "c-selected-items-panel-item__image-wrapper" >
49
+ < Thumbnail thumbnailData = { thumbnailData } iconExtraClasses = "ibexa-icon--small" />
50
+ </ div >
51
+ < div className = "c-selected-items-panel-item__info" >
52
+ < span className = "c-selected-items-panel-item__info-name" > { name } </ span >
53
+ < span className = "c-selected-items-panel-item__info-description" > { description } </ span >
54
+ </ div >
55
+ < div className = "c-selected-items-panel-item__actions-wrapper" >
56
+ { sortedActions . map ( ( action ) => {
57
+ const Component = action . component ;
57
58
58
- return < Component key = { action . id } item = { item } /> ;
59
- } ) }
60
- < button
61
- type = "button"
62
- className = "c-selected-items-panel-item__remove-button btn ibexa-btn ibexa-btn--ghost ibexa-btn--no-text"
63
- onClick = { removeFromSelection }
64
- title = { removeItemLabel }
65
- data-tooltip-container-selector = ".c-udw-tab"
66
- >
67
- < Icon name = "discard" extraClasses = "ibexa-icon--tiny-small" />
68
- </ button >
59
+ return < Component key = { action . id } item = { item } /> ;
60
+ } ) }
61
+ < button
62
+ type = "button"
63
+ className = "c-selected-items-panel-item__remove-button btn ibexa-btn ibexa-btn--ghost ibexa-btn--no-text"
64
+ onClick = { removeFromSelection }
65
+ title = { removeItemLabel }
66
+ data-tooltip-container-selector = ".c-udw-tab"
67
+ >
68
+ < Icon name = "discard" extraClasses = "ibexa-icon--tiny-small" />
69
+ </ button >
70
+ </ div >
69
71
</ div >
72
+ < div className = "c-selected-items-panel-item__extra-content" > { extraContent } </ div >
70
73
</ div >
71
74
) ;
72
75
} ;
@@ -78,7 +81,12 @@ SelectedItemsPanelItem.propTypes = {
78
81
resource : PropTypes . string . isRequired ,
79
82
} ) . isRequired ,
80
83
name : PropTypes . string . isRequired ,
81
- description : PropTypes . string . isRequired ,
84
+ description : PropTypes . node . isRequired ,
85
+ extraContent : PropTypes . oneOfType ( [ PropTypes . arrayOf ( PropTypes . node ) , PropTypes . node ] ) ,
86
+ } ;
87
+
88
+ SelectedItemsPanelItem . defaultProps = {
89
+ extraContent : null ,
82
90
} ;
83
91
84
92
export default SelectedItemsPanelItem ;
0 commit comments