Skip to content

Commit

Permalink
Fix various clipping issues with message buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny-signal committed Sep 30, 2021
1 parent 19e700a commit 3534408
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
8 changes: 7 additions & 1 deletion stylesheets/_modules.scss
Expand Up @@ -322,6 +322,7 @@
display: flex;
flex-direction: column;
width: 100%;
min-width: 0;
}
.module-message__container {
position: relative;
Expand Down Expand Up @@ -9269,7 +9270,12 @@ button.module-image__border-overlay:focus {
@media (min-width: 835px) and (max-width: 925px) {
.module-message {
// Add 2px for 1px border
max-width: 376px;
max-width: 360px;

&--with-avatar {
// Remove 36px from avatar
max-width: 324px;
}
}

// Spec: container < 438px
Expand Down
28 changes: 14 additions & 14 deletions ts/components/conversation/Message.tsx
Expand Up @@ -1170,21 +1170,20 @@ export class Message extends React.PureComponent<Props, State> {
);
}

public hasAvatar(): boolean {
const { collapseMetadata, conversationType, direction } = this.props;

return Boolean(
!collapseMetadata &&
conversationType === 'group' &&
direction !== 'outgoing'
);
}

public renderAvatar(): JSX.Element | undefined {
const {
author,
collapseMetadata,
conversationType,
direction,
i18n,
showContactModal,
} = this.props;
const { author, i18n, showContactModal } = this.props;

if (
collapseMetadata ||
conversationType !== 'group' ||
direction === 'outgoing'
) {
if (!this.hasAvatar()) {
return undefined;
}

Expand Down Expand Up @@ -2409,7 +2408,8 @@ export class Message extends React.PureComponent<Props, State> {
'module-message',
`module-message--${direction}`,
isSelected ? 'module-message--selected' : null,
expiring ? 'module-message--expired' : null
expiring ? 'module-message--expired' : null,
this.hasAvatar() ? 'module-message--with-avatar' : null
)}
tabIndex={0}
// We pretend to be a button because we sometimes contain buttons and a button
Expand Down

0 comments on commit 3534408

Please sign in to comment.