How to truncate text with JS/React, and replace the end of the line with a custom SVG icon instead of the CSS default ellipsis (...)?
Example situation:
.container {
width: 150px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
background: #90e4ff;
margin-bottom: 8px;
padding: 2px;
}
<div class="container">
The text here fits.
</div>
<div class="container">
This text here is way too long and certainly doesn't fit.
</div>
The output in the second div with the too long text is: This text here is way...
But the desired output would be: This text here is way<CustomIcon>