@@ -6,6 +6,7 @@ import { classNames } from 'utils/classnames';
6
6
import { buildImageCacheUrl , NextImageProps } from 'components/_common/image/NextImage' ;
7
7
import { XpImage } from 'components/_common/image/XpImage' ;
8
8
import { useSWRImmutableOnScrollIntoView } from 'utils/fetch/useSWRImmutableOnScrollIntoView' ;
9
+ import { Language } from 'translations' ;
9
10
10
11
import styleCommon from 'components/_common/illustration/Illustration.module.scss' ;
11
12
import styleStatic from './IllustrationStatic.module.scss' ;
@@ -16,6 +17,7 @@ type ValidIcon = DefinedIcon & Required<Pick<DefinedIcon, 'mediaUrl'>>;
16
17
type StaticIconProps = {
17
18
icon : ValidIcon ;
18
19
isEditorView : boolean ;
20
+ language : Language ;
19
21
className ?: string ;
20
22
} ;
21
23
@@ -31,13 +33,13 @@ const fetchSvgData = (url: string) =>
31
33
. then ( ( res ) => ( res . ok ? res . text ( ) : null ) )
32
34
. catch ( ( _ ) => null ) ;
33
35
34
- const SvgIcon = ( { icon, isEditorView, className } : StaticIconProps ) => {
36
+ const SvgIcon = ( { icon, isEditorView, className, language } : StaticIconProps ) => {
35
37
const elementId = useId ( ) ;
36
38
37
39
const { data : svgData } = useSWRImmutableOnScrollIntoView ( {
38
40
url : buildImageCacheUrl ( {
39
41
...nextImageProps ,
40
- src : getMediaUrl ( icon . mediaUrl , isEditorView ) ,
42
+ src : getMediaUrl ( icon . mediaUrl , isEditorView , language ) ,
41
43
isEditorView,
42
44
} ) ,
43
45
fetchFunc : fetchSvgData ,
@@ -80,7 +82,7 @@ type Props = {
80
82
} ;
81
83
82
84
export const IllustrationStatic = ( { illustration, className } : Props ) => {
83
- const { editorView } = usePageContentProps ( ) ;
85
+ const { editorView, language } = usePageContentProps ( ) ;
84
86
85
87
if ( ! illustration ) {
86
88
return null ;
@@ -96,10 +98,20 @@ export const IllustrationStatic = ({ illustration, className }: Props) => {
96
98
return (
97
99
< span className = { classNames ( styleCommon . image , className ) } aria-hidden = { 'true' } >
98
100
{ isValidIcon ( icon1 ?. icon ) && (
99
- < StaticIcon icon = { icon1 . icon } isEditorView = { ! ! editorView } className = { 'back' } />
101
+ < StaticIcon
102
+ icon = { icon1 . icon }
103
+ isEditorView = { ! ! editorView }
104
+ language = { language }
105
+ className = { 'back' }
106
+ />
100
107
) }
101
108
{ isValidIcon ( icon2 ?. icon ) && (
102
- < StaticIcon icon = { icon2 . icon } isEditorView = { ! ! editorView } className = { 'front' } />
109
+ < StaticIcon
110
+ icon = { icon2 . icon }
111
+ isEditorView = { ! ! editorView }
112
+ language = { language }
113
+ className = { 'front' }
114
+ />
103
115
) }
104
116
</ span >
105
117
) ;
0 commit comments