feat(file-sharing): [closes #308] scale shared images to fit

This commit is contained in:
Jeremy Kahn 2024-06-05 08:10:27 -05:00
parent 73218f4eea
commit a8dff459f3

View File

@ -1,5 +1,6 @@
import { useContext, useEffect, useRef, useState } from 'react' import { useContext, useEffect, useRef, useState } from 'react'
import { TorrentFile } from 'webtorrent' import { TorrentFile } from 'webtorrent'
import Box from '@mui/material/Box'
import CircularProgress from '@mui/material/CircularProgress' import CircularProgress from '@mui/material/CircularProgress'
import Typography from '@mui/material/Typography' import Typography from '@mui/material/Typography'
@ -37,13 +38,13 @@ export const InlineFile = ({ file }: InlineFileProps) => {
}, [file, containerRef, shellContext.roomId]) }, [file, containerRef, shellContext.roomId])
return ( return (
<div ref={containerRef}> <Box ref={containerRef} sx={{ '& img': { maxWidth: '100%' } }}>
{didRenderingMediaFail && ( {didRenderingMediaFail && (
<Typography sx={{ fontStyle: 'italic' }}> <Typography sx={{ fontStyle: 'italic' }}>
Media failed to render Media failed to render
</Typography> </Typography>
)} )}
</div> </Box>
) )
} }