Skip to content

Commit 3c9b78c

Browse files
committed
fix: draft.js text need to be a string
1 parent fa0cdf4 commit 3c9b78c

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ const messages = defineMessages({
3131
*/
3232
const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
3333
const intl = useIntl();
34+
const plainTitle = data.title?.blocks?.[0]?.text || null;
35+
const cardReadMoreAriaLabel = plainTitle
36+
? intl.formatMessage(messages.approfondisci) +
37+
' ' +
38+
(plainTitle.length > 80 ? plainTitle.slice(0, 80) + '…' : plainTitle)
39+
: undefined;
3440
return (
3541
<Card
3642
className="card-bg rounded subblock-view"
@@ -69,14 +75,7 @@ const ViewBlock = ({ data, isOpen, toggle, id, index }) => {
6975
tag={UniversalLink}
7076
href={data.href ?? '#'}
7177
text={data.linkMoreTitle || intl.formatMessage(messages.vedi)}
72-
aria-label={
73-
data.title &&
74-
intl.formatMessage(messages.approfondisci) +
75-
' ' +
76-
(data.title.length > 80
77-
? data.title.slice(0, 80) + '…'
78-
: data.title)
79-
}
78+
aria-label={cardReadMoreAriaLabel}
8079
/>
8180
)}
8281
</CardBody>

0 commit comments

Comments
 (0)