feat: converted quote author and text to styled components

pull/2757/head
William Grant 2 years ago
parent d7bc8213d6
commit 3249d2ff4c

@ -1,7 +1,24 @@
import classNames from 'classnames';
import React = require('react'); import React = require('react');
import { ContactName } from '../../../ContactName'; import { ContactName } from '../../../ContactName';
import { PubKey } from '../../../../../session/types'; import { PubKey } from '../../../../../session/types';
import styled from 'styled-components';
const StyledQuoteAuthor = styled.div<{ isIncoming: boolean }>`
color: ${props =>
props.isIncoming
? 'var(--message-bubbles-received-text-color)'
: 'var(--message-bubbles-sent-text-color)'};
font-size: 15px;
font-weight: bold;
line-height: 18px;
margin-bottom: 5px;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
.module-contact-name {
font-weight: bold;
}
`;
type QuoteAuthorProps = { type QuoteAuthorProps = {
author: string; author: string;
@ -16,12 +33,7 @@ export const QuoteAuthor = (props: QuoteAuthorProps) => {
const { authorProfileName, author, authorName, isFromMe, isIncoming } = props; const { authorProfileName, author, authorName, isFromMe, isIncoming } = props;
return ( return (
<div <StyledQuoteAuthor isIncoming={isIncoming}>
className={classNames(
'module-quote__primary__author',
isIncoming ? 'module-quote__primary__author--incoming' : null
)}
>
{isFromMe ? ( {isFromMe ? (
window.i18n('you') window.i18n('you')
) : ( ) : (
@ -33,6 +45,6 @@ export const QuoteAuthor = (props: QuoteAuthorProps) => {
shouldShowPubkey={Boolean(props.showPubkeyForAuthor)} shouldShowPubkey={Boolean(props.showPubkeyForAuthor)}
/> />
)} )}
</div> </StyledQuoteAuthor>
); );
}; };

@ -7,6 +7,34 @@ import classNames from 'classnames';
import { MessageBody } from '../MessageBody'; import { MessageBody } from '../MessageBody';
import { MIME } from '../../../../../types'; import { MIME } from '../../../../../types';
import { GoogleChrome } from '../../../../../util'; import { GoogleChrome } from '../../../../../util';
import styled from 'styled-components';
const StyledQuoteText = styled.div<{ isIncoming: boolean }>`
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
font-size: 15px;
line-height: 18px;
text-align: start;
overflow: hidden;
overflow-wrap: break-word;
word-wrap: break-word;
word-break: break-word;
white-space: pre-wrap;
color: ${props =>
props.isIncoming
? 'var(--message-bubbles-received-text-color)'
: 'var(--message-bubbles-sent-text-color)'};
a {
color: ${props =>
props.isIncoming
? 'var(--color-received-message-text)'
: 'var(--message-bubbles-sent-text-color)'};
}
`;
function getTypeLabel({ function getTypeLabel({
contentType, contentType,
@ -41,15 +69,9 @@ export const QuoteText = (
if (text) { if (text) {
return ( return (
<div <StyledQuoteText isIncoming={isIncoming} dir="auto">
dir="auto"
className={classNames(
'module-quote__primary__text',
isIncoming ? 'module-quote__primary__text--incoming' : null
)}
>
<MessageBody text={text} disableLinks={true} disableJumbomoji={true} isGroup={isGroup} /> <MessageBody text={text} disableLinks={true} disableJumbomoji={true} isGroup={isGroup} />
</div> </StyledQuoteText>
); );
} }

Loading…
Cancel
Save