fix(react): messages truncating

This commit is contained in:
Pavel Prichodko 2022-04-13 19:20:57 +02:00
parent 8127057f50
commit e31b7abff5
No known key found for this signature in database
GPG Key ID: 8E4C82D464215E83
5 changed files with 17 additions and 19 deletions

View File

@ -6,7 +6,7 @@ import { GifIcon } from '~/src/icons/gif-icon'
import { ImageIcon } from '~/src/icons/image-icon' import { ImageIcon } from '~/src/icons/image-icon'
import { StickerIcon } from '~/src/icons/sticker-icon' import { StickerIcon } from '~/src/icons/sticker-icon'
import { styled } from '~/src/styles/config' import { styled } from '~/src/styles/config'
import { Flex, IconButton } from '~/src/system' import { Box, Flex, IconButton } from '~/src/system'
import { InputReply } from './input-reply' import { InputReply } from './input-reply'
@ -34,9 +34,11 @@ export const ChatInput = (props: Props) => {
return ( return (
<Wrapper> <Wrapper>
<IconButton label="Add file"> <Box css={{ paddingBottom: 6 }}>
<ImageIcon /> <IconButton label="Add file" color="gray">
</IconButton> <ImageIcon />
</IconButton>
</Box>
<Bubble> <Bubble>
{state.message && <InputReply message={state.message} />} {state.message && <InputReply message={state.message} />}
<InputWrapper> <InputWrapper>
@ -67,7 +69,7 @@ const Wrapper = styled('div', {
display: 'flex', display: 'flex',
overflow: 'hidden', overflow: 'hidden',
alignItems: 'flex-end', alignItems: 'flex-end',
padding: '12px 8px 12px 10px', padding: '12px 8px 12px 4px',
gap: 4, gap: 4,
}) })

View File

@ -38,7 +38,7 @@ export const InputReply = (props: Props) => {
</Flex> </Flex>
{message.type === 'text' && ( {message.type === 'text' && (
<Flex> <Flex>
<Text size="13" truncate={false}> <Text size="13" truncate>
{message.text} {message.text}
</Text> </Text>
</Flex> </Flex>
@ -56,7 +56,7 @@ export const InputReply = (props: Props) => {
{message.type === 'image-text' && ( {message.type === 'image-text' && (
<Box> <Box>
<Flex> <Flex>
<Text size="13" truncate={false}> <Text size="13" truncate>
{message.text} {message.text}
</Text> </Text>
</Flex> </Flex>

View File

@ -65,7 +65,7 @@ export const ChatMessage = (props: Props) => {
<Wrapper> <Wrapper>
<Avatar size={44} /> <Avatar size={44} />
<Box> <Box>
<ChatInput value={text} /> <ChatInput value={message?.text} />
<Flex gap={2}> <Flex gap={2}>
<Button <Button
variant="outline" variant="outline"
@ -153,11 +153,11 @@ export const ChatMessage = (props: Props) => {
<Avatar size={44} src={contact.imageUrl} /> <Avatar size={44} src={contact.imageUrl} />
</button> </button>
<DropdownMenu> <DropdownMenu>
<div> <Flex direction="column" align="center" gap="1">
<Avatar size="36" src={contact.imageUrl} /> <Avatar size="36" src={contact.imageUrl} />
<Text>{contact.name}</Text> <Text>{contact.name}</Text>
<EmojiHash /> <EmojiHash />
</div> </Flex>
<DropdownMenu.Separator /> <DropdownMenu.Separator />
<DropdownMenu.Item icon={<BellIcon />}> <DropdownMenu.Item icon={<BellIcon />}>
View Profile View Profile

View File

@ -24,14 +24,7 @@ export const MessageReply = (props: Props) => {
</Flex> </Flex>
{reply.type === 'text' && ( {reply.type === 'text' && (
<Flex> <Flex>
<Text <Text color="gray" size="13" truncate>
color="gray"
size="13"
truncate={false}
css={{
lineClamp: 1,
}}
>
{reply.text} {reply.text}
</Text> </Text>
</Flex> </Flex>
@ -50,7 +43,7 @@ export const MessageReply = (props: Props) => {
)} )}
{reply.type === 'image-text' && ( {reply.type === 'image-text' && (
<Flex direction="column" gap={1}> <Flex direction="column" gap={1}>
<Text color="gray" size="13" truncate={false}> <Text color="gray" size="13" truncate>
{reply.text} {reply.text}
</Text> </Text>
<Image <Image

View File

@ -78,6 +78,8 @@ const Wrapper = styled('div', {
display: 'flex', display: 'flex',
alignItems: 'stretch', alignItems: 'stretch',
background: '#fff', background: '#fff',
maxWidth: '100%',
minWidth: 1,
}) })
const ContentWrapper = styled('div', { const ContentWrapper = styled('div', {
@ -98,4 +100,5 @@ const Main = styled('div', {
flex: 1, flex: 1,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
minWidth: 1,
}) })