Skip to content

Commit

Permalink
VoteText: add rules to wrap long links
Browse files Browse the repository at this point in the history
  • Loading branch information
AquiGorka committed Sep 10, 2019
1 parent 4c0e894 commit 7741c3a
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions apps/voting/app/src/components/VoteText.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,37 @@ const VoteText = React.memo(

return (
<TextComponent>
{text.split('\n').map((line, i) => (
<React.Fragment key={i}>
{transformAddresses(line, (part, isAddress, index) =>
isAddress ? (
<span title={part} key={index}>
{' '}
<LocalIdentityBadge
badgeOnly={disabled}
compact
entity={part}
/>{' '}
</span>
) : (
<span key={index}>{part}</span>
)
)}
<br />
</React.Fragment>
))}
<span
css={`
a {
word-break: break-all;
white-space: normal;
text-align: left;
}
`}
>
{text.split('\n').map((line, i) => (
<React.Fragment key={i}>
{transformAddresses(
line,
(part, isAddress, index) =>
isAddress ? (
<span title={part} key={index}>
{' '}
<LocalIdentityBadge
badgeOnly={disabled}
compact
entity={part}
/>{' '}
</span>
) : (
<span key={index}>{part}</span>
)
)}
<br />
</React.Fragment>
))}
</span>
</TextComponent>
)
},
Expand Down

0 comments on commit 7741c3a

Please sign in to comment.