Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4주차] 이현영 미션 제출합니다. #19

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fd3af98
style: 기본 마크업
hamo-o Sep 29, 2022
489440a
refactor: Header 컴포넌트 분리
hamo-o Sep 29, 2022
73388d2
feat: handleSubmit() 추가 && refactor: InputBox 컴포넌트 분리
hamo-o Sep 30, 2022
9142feb
refactor: ChatBoxList 컴포넌트 분리
hamo-o Sep 30, 2022
47fd40f
feat: useContext로 chats 배열 공급
hamo-o Sep 30, 2022
bc5bbe1
fix: 배열 prop으로 내려주기
hamo-o Sep 30, 2022
be858ce
fix: ChatBox 컴포넌트에 prop 전달
hamo-o Sep 30, 2022
0e3f9e2
fix: User배열 위치 변경
hamo-o Sep 30, 2022
051acf7
feat: enterKey, shiftKey 처리
hamo-o Sep 30, 2022
bfb4d50
fix: setChats user_id값 수정 && ChatBoxList 렌더링 내용 수정
hamo-o Sep 30, 2022
3d37248
feat: scrollTo() 구현
hamo-o Sep 30, 2022
bbb1deb
fix: json 파일 변경 && design: ChatBox css 수정
hamo-o Oct 1, 2022
4a7d4a0
fix: anytype 수정
hamo-o Oct 2, 2022
7036d54
refactor: interface 분리
hamo-o Oct 4, 2022
ba84517
refactor: React.FC 대체 && chore: 사용하지 않는 hook 정리
hamo-o Oct 5, 2022
e00d00b
feat: json 파일 추가
hamo-o Nov 2, 2022
c9b60b7
refactor: context > recoil 사용
hamo-o Nov 2, 2022
3de2c14
feat: page routing
hamo-o Nov 2, 2022
9bd10a9
feat: Header 추가
hamo-o Nov 3, 2022
c110bee
feat: 친구 목록 페이지 구현
hamo-o Nov 3, 2022
4f14b31
feat: navbar 구현
hamo-o Nov 3, 2022
6c75c53
feat: 채팅 페이지 구현
hamo-o Nov 3, 2022
600c678
chore: components 폴더 정리
hamo-o Nov 3, 2022
2156387
feat: chatRoom navigate 처리
hamo-o Nov 3, 2022
635e28a
feat: useInput 구현
hamo-o Nov 4, 2022
27f77b3
feat: 검색 기능 구현
hamo-o Nov 4, 2022
8f0e12d
fix: ChatRoom 유저 설정
hamo-o Nov 4, 2022
0c65cb3
feat: 선택된 유저 구현
hamo-o Nov 4, 2022
b9373b9
fix: 친구목록 curUser 수정
hamo-o Nov 4, 2022
7d40c42
refactor: useInput ChatInput에 활용
hamo-o Nov 4, 2022
d9a7387
chore: 프로필 변경
hamo-o Nov 4, 2022
4136723
feat: 상태메시지 추가
hamo-o Nov 4, 2022
fba91c7
design: font 저장
hamo-o Nov 4, 2022
989892f
fix: img 깨짐 수정
hamo-o Nov 5, 2022
e3a8b9a
fix: key값 오류 수정
hamo-o Nov 5, 2022
0a5f2b7
fix: ChatBox key값 중복 해결
hamo-o Nov 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function App() {
<Route path="/" element={<Friends />} />
<Route path="/chatList" element={<Chatting />} />
<Route path="/setting" element={<Setting />} />
<Route path="/chatRoom" element={<ChatRoom />} />
<Route path="/chatRoom/:id" element={<ChatRoom />} />
</Routes>
</BrowserRouter>
);
Expand Down
25 changes: 19 additions & 6 deletions src/components/chatRooms/ChatRoomItem.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useNavigate } from 'react-router-dom';
import { useRecoilValue } from 'recoil';

import styled from 'styled-components';
Expand All @@ -9,8 +10,16 @@ const ChatRoomItem = (user: User) => {
const myChats = chats.filter((chat) => chat.user_id === user.user_id);
console.log(myChats[0]);

const navigate = useNavigate();

const id = user.user_id;

return (
<UserItemWrapper>
<UserItemWrapper
onClick={() => {
navigate(`/chatRoom/${id}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와.. 전 link로 그냥 컴포넌트를 덮어버렸는데 네비게이트가 더 좋은 거 같아요 ㅠ.ㅠ 굿굿..

}}
>
<UserImgWrapper isSelected={user.isSelected}>
<UserImg src={user.user_img} />
</UserImgWrapper>
Expand Down Expand Up @@ -43,16 +52,20 @@ const UserImg = styled.img`
object-fit: cover;
`;

const UserInfoWrapper = styled.div`
display: flex;
flex-direction: column;
gap: 0.3rem;
`;

const UserName = styled.div`
font-size: 0.9rem;
font-weight: 600;
`;

const UserInfoWrapper = styled.div`
display: flex;
flex-direction: column;
const Message = styled.div`
font-size: 0.85rem;
color: gray;
`;

const Message = styled.div``;

export default ChatRoomItem;
6 changes: 5 additions & 1 deletion src/components/friends/FriendsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ const FriendsList = () => {
{users.map((it) => (
<>
<Friend key={it.user_id} {...it} />
{it.isSelected ? <FriendsNum>친구 {users.length}</FriendsNum> : <></>}
{it.isSelected ? (
<FriendsNum>친구 {users.length - 1}</FriendsNum>
) : (
<></>
)}
</>
))}
</Friends>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/ChatRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import InputBox from '../components/InputBox';
import ChatBoxList from '../components/chatRoom/ChatBoxList';

const ChatRoom = () => {
// const { id } = useParams();
const id = 2;
const { id } = useParams();

return (
<Container>
<ChatHeader />
<ChatBoxList />
<InputBox id={id} />
<InputBox id={2} />
</Container>
);
};
Expand Down