Skip to content

Commit

Permalink
Merge pull request #97 from sharemindteam/inyoung
Browse files Browse the repository at this point in the history
[Featrue] 채팅 시작, 몇가지 예외처리
  • Loading branch information
rmdnps10 authored Jan 26, 2024
2 parents 18f3bf1 + 7fd410e commit 92dbca2
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 9 deletions.
69 changes: 69 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.1",
"react-scripts": "5.0.1",
"react-textarea-autosize": "^8.5.3",
"recoil": "^0.7.7",
"recoil-persist": "^5.1.0",
"styled-components": "^6.1.0",
Expand Down
39 changes: 35 additions & 4 deletions src/components/Seller/SellerChat/ChatBottomSection.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import { Button } from 'components/Common/Button';
import Input from 'components/Common/Input';
import { Space } from 'components/Common/Space';
import React from 'react';
import React, { useRef } from 'react';
import styled from 'styled-components';
import { Grey3, Grey5 } from 'styles/color';
import { Grey3, Grey5, Grey6 } from 'styles/color';
import { ReactComponent as SendIcon } from 'assets/icons/icon-send.svg';
import TextareaAutosize from 'react-textarea-autosize';

function ChatBottomSection() {
const textRef: any = useRef(null);
const handleTextHeight = () => {
textRef.current.style.height = 'auto';
textRef.current.style.height = textRef.current.scrollHeight + 'px';
};
return (
<ChatBottomWrapper>
<TopBarSection>
Expand All @@ -25,7 +32,12 @@ function ChatBottomSection() {
/>
<Space height="1.5rem" />
<MessageSection>
<Input placeholder="메시지" width="100%" padding="1.2rem 1.5rem" />
<MessageTextArea
placeholder="메시지"
ref={textRef}
rows={1}
maxRows={4}
/>
<SendIcon />
</MessageSection>
</ChatBottomWrapper>
Expand All @@ -39,10 +51,10 @@ const ChatBottomWrapper = styled.div`
@media (min-width: 768px) {
width: 37.5rem;
}
height: 25.7rem;
border-radius: 2rem 2rem 0rem 0rem;
background-color: white;
box-shadow: 0px -2px 10px 0px rgba(0, 0, 0, 0.1);
padding-bottom: 3.2rem;
position: fixed;
bottom: 0;
display: flex;
Expand Down Expand Up @@ -84,4 +96,23 @@ const MessageSection = styled.div`
align-items: center;
gap: 0.8rem;
`;

const MessageTextArea = styled(TextareaAutosize)`
width: 100%;
padding: 1.2rem 1.5rem;
outline: none;
border: none;
resize: none;
border-radius: 1.2rem;
background-color: ${Grey6};
font-family: Pretendard;
font-size: 1.6rem;
font-style: normal;
font-weight: 400;
line-height: 110%; /* 1.76rem */
&:focus {
border: none;
outline: none;
}
`;
export default ChatBottomSection;
15 changes: 10 additions & 5 deletions src/components/Seller/SellerChat/ChatListSection.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import React from 'react'
import React from 'react';
import styled from 'styled-components';
import { Grey6 } from 'styles/color';

function ChatListSection() {
return (
<div>ChatListSection</div>
)
return <ChatListWrapper>ChatListSection</ChatListWrapper>;
}

export default ChatListSection
const ChatListWrapper = styled.div`
background: ${Grey6};
height: 100vh;
`;

export default ChatListSection;

0 comments on commit 92dbca2

Please sign in to comment.