Fix responsive message images
All checks were successful
Trigger cinny-mobile / dispatch (push) Successful in 2s

Constrain image attachments to their parent while preserving their aspect ratio.
This commit is contained in:
2026-08-25 00:02:45 +10:00
parent 862307ee7d
commit 47979718eb
2 changed files with 3 additions and 3 deletions

View File

@@ -262,7 +262,7 @@ export function MImage({ content, renderImageContent, outlined }: MImageProps) {
<AttachmentBox
style={{
width: toRem(width),
height: toRem(height),
aspectRatio: `${width} / ${height}`,
['--media-h' as string]: `${height}px`,
}}
data-paarrot-media-height={height}

View File

@@ -8,7 +8,7 @@ export const Attachment = recipe({
color: color.SurfaceVariant.OnContainer,
borderRadius: config.radii.R400,
overflow: 'hidden',
maxWidth: toRem(400),
maxWidth: `min(100%, ${toRem(400)})`,
},
variants: {
outlined: {
@@ -33,7 +33,7 @@ export const AttachmentHeader = style({
export const AttachmentBox = style([
DefaultReset,
{
maxWidth: toRem(400),
maxWidth: `min(100%, ${toRem(400)})`,
maxHeight: toRem(400),
overflow: 'hidden',
},