Skip to content

Commit ea9a392

Browse files
committed
WIP css changes
1 parent c9d6cc5 commit ea9a392

4 files changed

Lines changed: 13 additions & 24 deletions

File tree

src/app/components/RenderMessageContent.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useSetting } from '$state/hooks/settings';
1010
import { settingsAtom, CaptionPosition } from '$state/settings';
1111
import type { HTMLReactParserOptions } from 'html-react-parser';
1212
import type { Opts } from 'linkifyjs';
13-
import { Box, config } from 'folds';
13+
import { Box, config, toRem } from 'folds';
1414
import {
1515
AudioContent,
1616
DownloadFile,
@@ -264,14 +264,12 @@ function RenderMessageContentInternal({
264264
style={{
265265
display: 'flex',
266266
flexDirection: attachmentDirection,
267-
width: '100%',
268-
height: '100%',
269267
}}
270268
>
271269
<div
272270
style={{
273-
width: '100%',
274-
height: '100%',
271+
// height: '100%',
272+
backgroundColor: '#00AA00',
275273
}}
276274
>
277275
{attachment}

src/app/components/message/MGallery.css.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,23 @@ import { style } from '@vanilla-extract/css';
33
import { DefaultReset, color, config, toRem } from 'folds';
44

55
export const GalleryHolder = style({
6-
position: 'relative',
76
marginTop: config.space.S200,
87
});
98

109
export const GalleryItem = recipe({
1110
base: [
1211
DefaultReset,
1312
{
13+
display: 'flex',
1414
maxWidth: toRem(450),
1515
flexShrink: 0,
16+
flexGrow: 1,
1617
overflow: 'hidden',
1718
borderRadius: config.radii.R300,
19+
alignSelf: 'stretch',
20+
backgroundColor: '#AA00AA',
1821
},
1922
],
20-
variants: {
21-
isImage: {
22-
true: {
23-
height: toRem(300),
24-
},
25-
false: {
26-
maxHeight: toRem(300),
27-
},
28-
},
29-
},
3023
});
3124

3225
export const GalleryHolderGradient = recipe({

src/app/components/message/MGallery.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ export function MGallery({ content, renderItem, renderCaption }: MGalleryProps)
104104
)}
105105
<Box alignItems="Inherit" gap="200">
106106
{items.map((item, index) => (
107-
<div
108-
key={item.url ?? item.file?.url ?? index}
109-
className={css.GalleryItem({ isImage: item.itemtype === MsgType.Image })}
110-
>
107+
<div key={item.url ?? item.file?.url ?? index} className={css.GalleryItem()}>
111108
{renderItem(galleryItemToContent(item), index)}
112109
</div>
113110
))}

src/app/components/message/MsgTypeRenderers.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,21 +447,22 @@ export function MImage({ content, renderImageContent, outlined, fitParent }: MIm
447447
// this garbage is for portrait images, we cap the width so the card doesn't exceed the bounds of the image
448448
const displayWidth = imgH > imgW ? Math.round(MAX_SIZE * (imgW / imgH)) : MAX_SIZE;
449449
const height = scaleYDimension(imgInfo?.w || 400, displayWidth, imgInfo?.h || 400);
450+
450451
return (
451452
<Attachment
452453
style={{
453454
flexGrow: 1,
454455
flexShrink: 0,
455456
width: fitParent ? '100%' : toRem(displayWidth),
456-
height: fitParent ? '100%' : 'auto',
457+
height: fitParent ? MAX_SIZE : 'auto',
457458
}}
458459
outlined={outlined}
459460
>
460461
<AttachmentBox
461462
style={{
462463
flexGrow: 1,
463464
aspectRatio,
464-
width: fitParent ? '100%' : toRem(displayWidth),
465+
width: fitParent ? 'auto' : toRem(displayWidth),
465466
height: fitParent ? '100%' : toRem(height < 48 ? 48 : height),
466467
}}
467468
>
@@ -524,7 +525,7 @@ export function MVideo({
524525
flexGrow: 1,
525526
flexShrink: 0,
526527
width: fitParent ? '100%' : toRem(displayWidth),
527-
height: fitParent ? '100%' : 'auto',
528+
height: fitParent ? 400 : 'auto',
528529
}}
529530
outlined={outlined}
530531
>
@@ -544,7 +545,7 @@ export function MVideo({
544545
</AttachmentHeader>
545546
<AttachmentBox
546547
style={{
547-
width: fitParent ? '100%' : toRem(displayWidth),
548+
width: fitParent ? 'auto' : toRem(displayWidth),
548549
height: fitParent ? '100%' : toRem(height < 48 ? 48 : height),
549550
}}
550551
>

0 commit comments

Comments
 (0)