mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-26 07:22:10 -05:00
Improve ImageViewer
styles
This commit is contained in:
parent
de05fad9f4
commit
002d565b3f
2 changed files with 25 additions and 4 deletions
|
@ -1,6 +1,16 @@
|
||||||
.viewer {
|
.viewer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border-end-end-radius: 4px;
|
||||||
|
border-end-start-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
max-width: 90vw;
|
max-width: 90vw;
|
||||||
max-height: 90vh;
|
max-height: 75vh;
|
||||||
|
border-bottom: thin solid var(--tertiary-foreground);
|
||||||
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,10 @@ export function ImageViewer({ attachment, embed, onClose }: Props) {
|
||||||
return "https://jan.revolt.chat/proxy?url=" + encodeURIComponent(url);
|
return "https://jan.revolt.chat/proxy?url=" + encodeURIComponent(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachment && attachment.metadata.type !== "Image") return null;
|
if (attachment?.metadata.type !== "Image") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const client = useContext(AppContext);
|
const client = useContext(AppContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -30,13 +33,21 @@ export function ImageViewer({ attachment, embed, onClose }: Props) {
|
||||||
<div className={styles.viewer}>
|
<div className={styles.viewer}>
|
||||||
{attachment && (
|
{attachment && (
|
||||||
<>
|
<>
|
||||||
<img src={client.generateFileURL(attachment)} />
|
<img
|
||||||
|
src={client.generateFileURL(attachment)}
|
||||||
|
width={attachment.metadata.width}
|
||||||
|
height={attachment.metadata.height}
|
||||||
|
/>
|
||||||
<AttachmentActions attachment={attachment} />
|
<AttachmentActions attachment={attachment} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{embed && (
|
{embed && (
|
||||||
<>
|
<>
|
||||||
<img src={proxyImage(embed.url)} />
|
<img
|
||||||
|
src={proxyImage(embed.url)}
|
||||||
|
width={attachment.metadata.width}
|
||||||
|
height={attachment.metadata.height}
|
||||||
|
/>
|
||||||
<EmbedMediaActions embed={embed} />
|
<EmbedMediaActions embed={embed} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue