Add image to replying (#148)
This commit is contained in:
parent
3c9d514b92
commit
8b79cf397e
|
@ -257,6 +257,7 @@ export function ChatInput({ reply, setReply }: ChatInputProps) {
|
||||||
{reply.sender}
|
{reply.sender}
|
||||||
</ReplyTo>
|
</ReplyTo>
|
||||||
<ReplyOn>{reply.content}</ReplyOn>
|
<ReplyOn>{reply.content}</ReplyOn>
|
||||||
|
{reply.image && <ImagePreview src={reply.image} />}
|
||||||
<CloseButton onClick={() => setReply(undefined)}>
|
<CloseButton onClick={() => setReply(undefined)}>
|
||||||
{" "}
|
{" "}
|
||||||
<ClearSvg width={20} height={20} className="input" />
|
<ClearSvg width={20} height={20} className="input" />
|
||||||
|
@ -442,20 +443,18 @@ const ReplyWrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-height: 96px;
|
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
background: rgba(0, 0, 0, 0.1);
|
background: rgba(0, 0, 0, 0.1);
|
||||||
color: ${({ theme }) => theme.primary};
|
color: ${({ theme }) => theme.primary};
|
||||||
border-radius: 14px 14px 4px 14px;
|
border-radius: 14px 14px 4px 14px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
${textSmallStyles};
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const ReplyTo = styled.div`
|
export const ReplyTo = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
${textSmallStyles};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const ReplyOn = styled.div`
|
export const ReplyOn = styled.div`
|
||||||
|
@ -463,4 +462,5 @@ export const ReplyOn = styled.div`
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
${textSmallStyles};
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -64,12 +64,22 @@ function ChatUiMessage({
|
||||||
<MessageWrapper className={`${mentioned && "mention"}`}>
|
<MessageWrapper className={`${mentioned && "mention"}`}>
|
||||||
{quote && (
|
{quote && (
|
||||||
<QuoteWrapper>
|
<QuoteWrapper>
|
||||||
<QuoteSvg width={22} height={25} />
|
<QuoteSvg
|
||||||
<QuoteAuthor>
|
width={22}
|
||||||
|
height={
|
||||||
|
quote.image && quote.content
|
||||||
|
? 88
|
||||||
|
: quote.image && !quote.content
|
||||||
|
? 68
|
||||||
|
: 25
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<QuoteSender>
|
||||||
{" "}
|
{" "}
|
||||||
<UserIcon memberView={true} /> {quote.sender}
|
<UserIcon memberView={true} /> {quote.sender}
|
||||||
</QuoteAuthor>
|
</QuoteSender>
|
||||||
<Quote>{quote.content}</Quote>
|
<Quote>{quote.content}</Quote>
|
||||||
|
{quote.image && <QuoteImage src={quote.image} />}
|
||||||
</QuoteWrapper>
|
</QuoteWrapper>
|
||||||
)}
|
)}
|
||||||
<UserMessageWrapper>
|
<UserMessageWrapper>
|
||||||
|
@ -119,6 +129,7 @@ function ChatUiMessage({
|
||||||
setReply({
|
setReply({
|
||||||
sender: message.sender,
|
sender: message.sender,
|
||||||
content: message.content,
|
content: message.content,
|
||||||
|
image: message.image,
|
||||||
id: message.id,
|
id: message.id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -381,10 +392,17 @@ const QuoteWrapper = styled.div`
|
||||||
position: relative;
|
position: relative;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const QuoteAuthor = styled(ReplyTo)`
|
const QuoteSender = styled(ReplyTo)`
|
||||||
color: ${({ theme }) => theme.secondary};
|
color: ${({ theme }) => theme.secondary};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Quote = styled(ReplyOn)`
|
const Quote = styled(ReplyOn)`
|
||||||
color: ${({ theme }) => theme.secondary};
|
color: ${({ theme }) => theme.secondary};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const QuoteImage = styled.img`
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-top: 4px;
|
||||||
|
`;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export type Reply = {
|
export type Reply = {
|
||||||
sender: string;
|
sender: string;
|
||||||
content: string;
|
content: string;
|
||||||
|
image?: string;
|
||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue