diff --git a/stylesheets/_session_theme.scss b/stylesheets/_session_theme.scss index 3b5c77e9d..c10b91eda 100644 --- a/stylesheets/_session_theme.scss +++ b/stylesheets/_session_theme.scss @@ -28,6 +28,7 @@ flex-direction: row; align-items: center; max-width: 95%; + color: var(--color-sent-message-text); @media (min-width: 1200px) { max-width: 65%; @@ -68,17 +69,14 @@ a { text-decoration: underline; - color: inherit; } } } - color: var(--color-sent-message-text); &__container--outgoing { .module-message__text { a { text-decoration: underline; - color: inherit; } } } diff --git a/ts/components/conversation/ImageGrid.tsx b/ts/components/conversation/ImageGrid.tsx index 72c2d3e29..24e87882b 100644 --- a/ts/components/conversation/ImageGrid.tsx +++ b/ts/components/conversation/ImageGrid.tsx @@ -20,48 +20,72 @@ type Props = { onClickAttachment?: (attachment: AttachmentTypeWithPath | AttachmentType) => void; }; -const StyledImageGrid = styled.div` +const StyledImageGrid = styled.div<{ flexDirection: 'row' | 'column' }>` display: inline-flex; - flex-direction: row; align-items: center; gap: var(--margins-sm); + flex-direction: ${props => props.flexDirection}; `; +// tslint:disable: cyclomatic-complexity max-func-body-length use-simple-attributes -const StyledImageGridColumn = styled.div` - display: inline-flex; - flex-direction: column; - align-items: center; - gap: var(--margins-sm); -`; +const Row = ( + props: Props & { renderedSize: number; startIndex: number; totalAttachmentsCount: number } +) => { + const { + attachments, + onError, + renderedSize, + startIndex, + onClickAttachment, + totalAttachmentsCount, + } = props; + const isMessageVisible = useContext(IsMessageVisibleContext); + const moreMessagesOverlay = totalAttachmentsCount > 3; + const moreMessagesOverlayText = moreMessagesOverlay ? `+${totalAttachmentsCount - 3}` : undefined; + + return ( + <> + {attachments.map((attachment, index) => { + const showOverlay = index === 1 && moreMessagesOverlay; + return ( + {getAlt(attachment)} + ); + })} + + ); +}; -// tslint:disable: cyclomatic-complexity max-func-body-length use-simple-attributes export const ImageGrid = (props: Props) => { const { attachments, onError, onClickAttachment } = props; - const isMessageVisible = useContext(IsMessageVisibleContext); - if (!attachments || !attachments.length) { return null; } - const shared = { - onClick: onClickAttachment, - onError: onError, - softCorners: true, - }; - if (attachments.length === 1 || !areAllAttachmentsVisual(attachments)) { return ( - - {getAlt(attachments[0])} + ); @@ -70,73 +94,43 @@ export const ImageGrid = (props: Props) => { if (attachments.length === 2) { // when we got 2 attachments we render them side by side with the full size of THUMBNAIL_SIDE return ( - - {getAlt(attachments[0])} - {getAlt(attachments[1])} + ); } - const moreMessagesOverlay = attachments.length > 3; - const moreMessagesOverlayText = moreMessagesOverlay ? `+${attachments.length - 3}` : undefined; - const columnImageSide = THUMBNAIL_SIDE / 2 - 5; - // we know only support having 3 attachments displayed at most. + // we know only support having 3 attachments displayed at most, the rest are on the overlay return ( - - {getAlt(attachments[0])} + - - {getAlt(attachments[1])} - {getAlt(attachments[2])} + - + ); }; diff --git a/ts/components/conversation/message/message-content/MessageContent.tsx b/ts/components/conversation/message/message-content/MessageContent.tsx index ccbbe6769..b2261f450 100644 --- a/ts/components/conversation/message/message-content/MessageContent.tsx +++ b/ts/components/conversation/message/message-content/MessageContent.tsx @@ -50,8 +50,8 @@ const StyledMessageOpaqueContent = styled.div<{ messageDirection: MessageModelTy : 'var(--color-sent-message-background)'}; align-self: ${props => (props.messageDirection === 'incoming' ? 'flex-start' : 'flex-end')}; - padding: 7px 13px; // FIXME - border-radius: 16px; //FIXME + padding: var(--padding-message-content); + border-radius: var(--border-radius-message-box); `; export const IsMessageVisibleContext = createContext(false); @@ -151,7 +151,7 @@ export const MessageContent = (props: Props) => { }} > - {hasContentAfterAttachmentAndQuote ? ( + {hasContentAfterAttachmentAndQuote && ( {!isDeleted && ( <> @@ -164,7 +164,7 @@ export const MessageContent = (props: Props) => { )} - ) : null} + )} {!isDeleted && (