Skip to content

Commit feaf9a2

Browse files
committed
Image block: Remoded getAltHelp and inlined the ternary directly into the help prop.
1 parent f6d7341 commit feaf9a2

1 file changed

Lines changed: 18 additions & 24 deletions

File tree

  • packages/block-library/src/image

packages/block-library/src/image/image.js

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -262,26 +262,6 @@ function ContentOnlyControls( {
262262
);
263263
}
264264

265-
function getAltHelp( { lockAltControls, lockAltControlsMessage } ) {
266-
if ( lockAltControls ) {
267-
return <>{ lockAltControlsMessage }</>;
268-
}
269-
return (
270-
<>
271-
<ExternalLink
272-
href={
273-
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
274-
__(
275-
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
276-
)
277-
}
278-
>
279-
{ __( 'Describe the purpose of the image.' ) }
280-
</ExternalLink>
281-
</>
282-
);
283-
}
284-
285265
export default function Image( {
286266
temporaryURL,
287267
isSideloading,
@@ -999,10 +979,24 @@ export default function Image( {
999979
value={ alt || '' }
1000980
onChange={ updateAlt }
1001981
readOnly={ lockAltControls }
1002-
help={ getAltHelp( {
1003-
lockAltControls,
1004-
lockAltControlsMessage,
1005-
} ) }
982+
help={
983+
lockAltControls ? (
984+
lockAltControlsMessage
985+
) : (
986+
<ExternalLink
987+
href={
988+
// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.
989+
__(
990+
'https://www.w3.org/WAI/tutorials/images/decision-tree/'
991+
)
992+
}
993+
>
994+
{ __(
995+
'Describe the purpose of the image.'
996+
) }
997+
</ExternalLink>
998+
)
999+
}
10061000
/>
10071001
</ToolsPanelItem>
10081002
) }

0 commit comments

Comments
 (0)