Skip to content

Commit

Permalink
image: set max dimensions for chat and align to start, fix other usages
Browse files Browse the repository at this point in the history
  • Loading branch information
arthyn committed Jan 14, 2025
1 parent 57729d4 commit 64e7fb3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions packages/ui/src/components/ChatMessage/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ const ChatContentRenderer = createContentRenderer({
reference: {
contentSize: '$l',
},
image: {
alignItems: 'flex-start',
imageProps: {
maxWidth: 600,
maxHeight: 600,
height: 'auto',
width: 'auto',
objectFit: 'contain',
},
},
},
});

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ const WebImage = ({
src={source.uri}
alt={alt}
style={{
...StyleSheet.flatten(style),
maxWidth: '100%',
height: props.height ? props.height : '100%',
objectFit: contentFit ? contentFit : undefined,
...StyleSheet.flatten(style),
}}
onLoad={handleLoad}
onError={handleError}
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/NotebookPost/NotebookPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export const NotebookPostHeroImage = styled(Image, {
width: '100%',
height: IMAGE_HEIGHT,
borderRadius: '$s',
objectFit: 'cover',
variants: {
size: {
$s: {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/PostContent/BlockRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ export function ImageBlock({

return (
<Pressable
borderRadius="$s"
overflow="hidden"
onPress={handlePress}
onLongPress={onLongPress}
Expand All @@ -265,6 +264,7 @@ export function ImageBlock({
? { aspectRatio: dimensions.aspect || undefined }
: {}),
}}
borderRadius="$s"
alt={block.alt}
onLoad={handleImageLoaded}
{...imageProps}
Expand Down

0 comments on commit 64e7fb3

Please sign in to comment.