@@ -8,8 +8,8 @@ import {getConnectorIconData} from 'ui/utils';
88import { registry } from '../../registry' ;
99import type { ConnectorIconViewProps } from '../ConnectorIcon/ConnectorIcon' ;
1010import { ConnectorIcon } from '../ConnectorIcon/ConnectorIcon' ;
11- import type { EntityIconSize , EntityIconType } from '../EntityIcon/EntityIcon' ;
1211import { EntityIcon , defaultIconSize } from '../EntityIcon/EntityIcon' ;
12+ import type { EntityIconProps , EntityIconSize , EntityIconType } from '../EntityIcon/EntityIcon' ;
1313
1414import iconFilesBroken from '../../assets/icons/broken.svg' ;
1515
@@ -53,12 +53,21 @@ export const getEntryIconData = ({type}: EntryData) => {
5353 return iconData ;
5454} ;
5555
56- const getEntityIconType = (
57- { scope, type} : EntryData ,
58- className ?: string ,
59- entityIconSize ?: EntityIconSize ,
60- overrideIconType ?: EntityIconType ,
61- ) => {
56+ type EntityIconTypeProps = {
57+ entryData : EntryData ;
58+ className ?: string ;
59+ entityIconSize ?: EntityIconSize ;
60+ overrideIconType ?: EntityIconType ;
61+ entityIconProps ?: Partial < EntityIconProps > ;
62+ } ;
63+
64+ const getEntityIconType = ( {
65+ entryData : { scope, type} ,
66+ className,
67+ entityIconSize,
68+ overrideIconType,
69+ entityIconProps = { } ,
70+ } : EntityIconTypeProps ) => {
6271 let iconType ;
6372
6473 if ( type ) {
@@ -78,7 +87,8 @@ const getEntityIconType = (
7887 type = { entityIconType as EntityIconType }
7988 iconSize = { iconSize }
8089 size = { entityIconSize }
81- classMixin = { className }
90+ className = { className }
91+ { ...entityIconProps }
8292 />
8393 ) ;
8494 }
@@ -90,10 +100,19 @@ interface EntryIconProps extends Partial<ConnectorIconViewProps> {
90100 entityIconSize ?: EntityIconSize ;
91101 // can be used to use connection icon without type of connection
92102 overrideIconType ?: EntityIconType ;
103+ entityIconProps ?: Partial < EntityIconProps > ;
93104}
94105
95106export const EntryIcon = ( props : EntryIconProps ) => {
96- const { entry, className, entityIconSize, overrideIconType, size, ...restProps } = props ;
107+ const {
108+ entry,
109+ className,
110+ entityIconSize,
111+ overrideIconType,
112+ size,
113+ entityIconProps,
114+ ...restProps
115+ } = props ;
97116 const iconData = getEntryIconData ( entry ) ;
98117 const iconSize = size ?? defaultIconSize [ entityIconSize || 's' ] ;
99118 if ( iconData ) {
@@ -108,8 +127,12 @@ export const EntryIcon = (props: EntryIconProps) => {
108127 ) ;
109128 }
110129 return (
111- getEntityIconType ( entry , className , entityIconSize , overrideIconType ) || (
112- < Icon data = { iconFilesBroken } className = { className } size = { iconSize } { ...restProps } />
113- )
130+ getEntityIconType ( {
131+ entryData : entry ,
132+ className,
133+ entityIconSize,
134+ overrideIconType,
135+ entityIconProps,
136+ } ) || < Icon data = { iconFilesBroken } className = { className } size = { iconSize } { ...restProps } />
114137 ) ;
115138} ;
0 commit comments