feat: pass in all props to quote component

converted quote primary text to styled components
pull/2757/head
William Grant 2 years ago
parent f0aeb59d54
commit bdbdb477da

@ -39,8 +39,7 @@ export const MessageQuote = (props: Props) => {
const { const {
text, text,
attachment, attachment,
// TODO isFromMe,
// isFromMe,
sender: quoteAuthor, sender: quoteAuthor,
authorProfileName, authorProfileName,
authorName, authorName,
@ -106,10 +105,10 @@ export const MessageQuote = (props: Props) => {
attachment={attachment} attachment={attachment}
isIncoming={direction === 'incoming'} isIncoming={direction === 'incoming'}
sender={displayedPubkey} sender={displayedPubkey}
authorProfileName={quote.authorProfileName} authorProfileName={authorProfileName}
authorName={quote.authorName} authorName={authorName}
referencedMessageNotFound={quote.referencedMessageNotFound || false} referencedMessageNotFound={referencedMessageNotFound || false}
isFromMe={quote.isFromMe || false} isFromMe={isFromMe || false}
/> />
); );
}; };

@ -73,6 +73,13 @@ const StyledQuote = styled.div<{
cursor: ${props => (props.onClick ? 'pointer' : 'auto')}; cursor: ${props => (props.onClick ? 'pointer' : 'auto')};
`; `;
const StyledQuoteTextContent = styled.div`
flex-grow: 1;
padding-inline-start: 10px;
padding-inline-end: 10px;
max-width: 100%;
`;
export const Quote = (props: QuotePropsWithListener) => { export const Quote = (props: QuotePropsWithListener) => {
const [imageBroken, setImageBroken] = useState(false); const [imageBroken, setImageBroken] = useState(false);
const handleImageErrorBound = () => { const handleImageErrorBound = () => {
@ -93,14 +100,13 @@ export const Quote = (props: QuotePropsWithListener) => {
hasAttachment={Boolean(!isEmpty(attachment))} hasAttachment={Boolean(!isEmpty(attachment))}
isIncoming={isIncoming} isIncoming={isIncoming}
onClick={onClick} onClick={onClick}
role="button"
> >
<QuoteIconContainer <QuoteIconContainer
attachment={attachment} attachment={attachment}
handleImageErrorBound={handleImageErrorBound} handleImageErrorBound={handleImageErrorBound}
imageBroken={imageBroken} imageBroken={imageBroken}
/> />
<div className="module-quote__primary"> <StyledQuoteTextContent>
<QuoteAuthor <QuoteAuthor
authorName={props.authorName} authorName={props.authorName}
author={props.sender} author={props.sender}
@ -111,7 +117,7 @@ export const Quote = (props: QuotePropsWithListener) => {
/> />
<QuoteGenericFile {...props} /> <QuoteGenericFile {...props} />
<QuoteText isIncoming={isIncoming} text={text} attachment={attachment} /> <QuoteText isIncoming={isIncoming} text={text} attachment={attachment} />
</div> </StyledQuoteTextContent>
</StyledQuote> </StyledQuote>
</div> </div>
); );

@ -11,7 +11,7 @@ const StyledQuoteAuthor = styled.div<{ isIncoming: boolean }>`
font-size: 15px; font-size: 15px;
font-weight: bold; font-weight: bold;
line-height: 18px; line-height: 18px;
margin-bottom: 5px; margin-bottom: 2px;
overflow-x: hidden; overflow-x: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;

@ -7,6 +7,7 @@ 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'; import styled from 'styled-components';
import { isEmpty } from 'lodash';
const StyledQuoteText = styled.div<{ isIncoming: boolean }>` const StyledQuoteText = styled.div<{ isIncoming: boolean }>`
display: -webkit-box; display: -webkit-box;
@ -66,7 +67,7 @@ export const QuoteText = (
const convoId = useSelector(getSelectedConversationKey); const convoId = useSelector(getSelectedConversationKey);
const isGroup = !useIsPrivate(convoId); const isGroup = !useIsPrivate(convoId);
if (attachment) { if (attachment && !isEmpty(attachment)) {
const { contentType, isVoiceMessage } = attachment; const { contentType, isVoiceMessage } = attachment;
const typeLabel = getTypeLabel({ contentType, isVoiceMessage }); const typeLabel = getTypeLabel({ contentType, isVoiceMessage });

Loading…
Cancel
Save