mirror of
https://github.com/urbit/shrub.git
synced 2024-11-29 14:57:12 +03:00
chat-ui: fix image previews from url types
This commit is contained in:
parent
c8cca2f261
commit
e06acb87be
File diff suppressed because one or more lines are too long
@ -29,12 +29,27 @@ export class Message extends Component {
|
||||
</span>
|
||||
);
|
||||
} else if ('url' in letter) {
|
||||
let imgMatch =
|
||||
/(jpg|img|png|gif|tiff|jpeg|JPG|IMG|PNG|TIFF|GIF|webp|WEBP|webm|WEBM)$/
|
||||
.exec(letter.url);
|
||||
let contents = letter.url;
|
||||
if (imgMatch) {
|
||||
contents = (
|
||||
<img
|
||||
src={letter.url}
|
||||
style={{
|
||||
width: "50%",
|
||||
maxWidth: "250px"
|
||||
}}
|
||||
></img>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<a className="body-regular-400 v-top"
|
||||
href={letter.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
{letter.url}
|
||||
{contents}
|
||||
</a>
|
||||
);
|
||||
} else if ('me' in letter) {
|
||||
|
Loading…
Reference in New Issue
Block a user