11import { type AudioPlayerState , ProgressBar , useAudioPlayer } from '../../AudioPlayback' ;
2- import { useMessageContext } from '../../../context' ;
2+ import { useComponentContext , useMessageContext } from '../../../context' ;
33import { useStateStore } from '../../../store' ;
44import { PlayButton } from '../../Button' ;
55import type { AudioProps } from '../Audio' ;
66import React from 'react' ;
7- import { IconLink } from '../../Icons' ;
7+ import { IconLink as DefaultIconLink } from '../../Icons' ;
88import { SafeAnchor } from '../../SafeAnchor' ;
99import type { CardProps } from './Card' ;
1010
@@ -21,22 +21,25 @@ const SourceLink = ({
2121 author_name,
2222 showUrl,
2323 url,
24- } : Pick < CardProps , 'author_name' > & { url : string ; showUrl ?: boolean } ) => (
25- < div
26- className = 'str-chat__message-attachment-card--source-link'
27- data-testid = 'card-source-link'
28- >
29- < IconLink />
30- < SafeAnchor
31- className = 'str-chat__message-attachment-card--url'
32- href = { url }
33- rel = 'noopener noreferrer'
34- target = '_blank'
24+ } : Pick < CardProps , 'author_name' > & { url : string ; showUrl ?: boolean } ) => {
25+ const { icons : { IconLink = DefaultIconLink } = { } } = useComponentContext ( ) ;
26+ return (
27+ < div
28+ className = 'str-chat__message-attachment-card--source-link'
29+ data-testid = 'card-source-link'
3530 >
36- { showUrl ? url : author_name || getHostFromURL ( url ) }
37- </ SafeAnchor >
38- </ div >
39- ) ;
31+ < IconLink />
32+ < SafeAnchor
33+ className = 'str-chat__message-attachment-card--url'
34+ href = { url }
35+ rel = 'noopener noreferrer'
36+ target = '_blank'
37+ >
38+ { showUrl ? url : author_name || getHostFromURL ( url ) }
39+ </ SafeAnchor >
40+ </ div >
41+ ) ;
42+ } ;
4043
4144const audioPlayerStateSelector = ( state : AudioPlayerState ) => ( {
4245 durationSeconds : state . durationSeconds ,
0 commit comments