fix: use js variables instead of css variables for Message corners

pull/2438/head
Audric Ackermann 3 years ago
parent 98b1302589
commit 7e32880ab0

@ -28,7 +28,7 @@ import { MessagePreview } from './MessagePreview';
import { MessageQuote } from './MessageQuote';
import { MessageText } from './MessageText';
import { ScrollToLoadedMessageContext } from '../../SessionMessagesListContainer';
import styled, { CSSProperties } from 'styled-components';
import styled from 'styled-components';
export type MessageContentSelectorProps = Pick<
MessageRenderingProps,
@ -96,35 +96,22 @@ function onClickOnMessageInnerContainer(event: React.MouseEvent<HTMLDivElement>)
}
}
const radiusLg = '18px';
const radiusSm = '4px';
const StyledMessageContent = styled.div<{
isOutgoing: boolean;
firstOfSeries: boolean;
lastOfSeries: boolean;
}>`
border-top-right-radius: ${props =>
props.isOutgoing
? props.firstOfSeries
? 'var(--radius-lg)'
: 'var(--radius-sm)'
: 'var(--radius-lg)'};
props.isOutgoing ? (props.firstOfSeries ? `${radiusLg}` : `${radiusSm}`) : `${radiusLg}`};
border-bottom-right-radius: ${props =>
props.isOutgoing
? props.lastOfSeries
? 'var(--radius-lg)'
: 'var(--radius-sm)'
: 'var(--radius-lg)'};
props.isOutgoing ? (props.lastOfSeries ? `${radiusLg}` : `${radiusSm}`) : `${radiusLg}`};
border-top-left-radius: ${props =>
!props.isOutgoing
? props.firstOfSeries
? 'var(--radius-lg)'
: 'var(--radius-sm)'
: 'var(--radius-lg)'};
!props.isOutgoing ? (props.firstOfSeries ? `${radiusLg}` : `${radiusSm}`) : `${radiusLg}`};
border-bottom-left-radius: ${props =>
!props.isOutgoing
? props.lastOfSeries
? 'var(--radius-lg)'
: 'var(--radius-sm)'
: 'var(--radius-lg)'};
!props.isOutgoing ? (props.lastOfSeries ? `${radiusLg}` : `${radiusSm}`) : `${radiusLg}`};
`;
export const IsMessageVisibleContext = createContext(false);
@ -226,13 +213,9 @@ export const MessageContent = (props: Props) => {
flashGreen && 'flash-green-once'
)}
style={
{
width: isShowingImage ? width : undefined,
'--radius-lg': '18px',
'--radius-sm': '4px',
} as CSSProperties
}
style={{
width: isShowingImage ? width : undefined,
}}
firstOfSeries={Boolean(firstMessageOfSeries || props.isDetailView)}
lastOfSeries={Boolean(lastMessageOfSeries || props.isDetailView)}
isOutgoing={direction === 'outgoing'}

Loading…
Cancel
Save