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주차] 이은비 미션 제출합니다 #22

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1b4d440
[chore] 공통 스타일 지정
silverain02 Sep 29, 2023
eb950ab
[chore] 초기세팅 typescript 맞춰 변경
silverain02 Sep 29, 2023
e0575dd
[feat] 채팅박스 컴포넌트
silverain02 Sep 29, 2023
20f7b02
[chore] icon 컴포넌트화
silverain02 Sep 29, 2023
e386d5f
[feat] input컴포넌트
silverain02 Sep 29, 2023
ae09e79
[feat] 입력값 처리 기능
silverain02 Sep 29, 2023
62802b9
[feat] localStorage에 chatData저장
silverain02 Sep 29, 2023
3864efe
[feat] input클릭 시 하단 스크롤 기능
silverain02 Sep 29, 2023
0e7ca9d
[chore] css일부 마진조정
silverain02 Sep 29, 2023
673e270
[chore] package 의존설정 변화
silverain02 Sep 29, 2023
472337b
[chore] 대화 시 사용자 전환 CSS 메시지 박스 변화
silverain02 Sep 29, 2023
134a720
[chore] 같은 시간 보여주지 않기
silverain02 Sep 29, 2023
50f6eae
[feat] 프로필 추가
silverain02 Sep 29, 2023
042a35b
[chore] redux 설치
silverain02 Nov 2, 2023
490b640
[chore]react router 설치
silverain02 Nov 2, 2023
4b8201d
[feat] 페이지 라우팅 적용
silverain02 Nov 2, 2023
bd359ad
[feat] footer구현
silverain02 Nov 3, 2023
ce23bd6
[chore] userData 세팅
silverain02 Nov 3, 2023
0f008bc
[chore] profile 스타일링
silverain02 Nov 3, 2023
add8959
[feat]친구리스트 배열 매핑
silverain02 Nov 3, 2023
bf9286c
[chore] 친구리스트 스타일링
silverain02 Nov 3, 2023
e03d921
[feat]myPage완성
silverain02 Nov 3, 2023
204a243
[feat]chatList mock data불러오기
silverain02 Nov 3, 2023
e1a59cb
[feat]chatList구현
silverain02 Nov 3, 2023
8201dc3
[feat]경로변경 후 userMock데이터 받아오기
silverain02 Nov 3, 2023
d821755
[feat]chatData연동
silverain02 Nov 3, 2023
f13b150
[feat]input기능 재건
silverain02 Nov 3, 2023
1a35cb6
[chore]mock data수정
silverain02 Nov 3, 2023
71f3f8b
[chore]말풍선 시간 조정
silverain02 Nov 3, 2023
567f19f
[chore] link색조정
silverain02 Nov 3, 2023
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
13,567 changes: 13,555 additions & 12 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@reduxjs/toolkit": "^1.9.7",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.5.5",
"@types/node": "^20.7.1",
"@types/react": "^18.2.23",
"@types/react-dom": "^18.2.8",
"@types/react-redux": "^7.1.28",
"@types/react-router-dom": "^5.3.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"react-router-dom": "^6.18.0",
"react-scripts": "latest_version",
"styled-components": "^6.0.8",
"styled-system": "^5.1.5",
"typescript": "^4.5.2",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
53 changes: 53 additions & 0 deletions public/data/chatData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[
{
"userId": 3,
"chatData": [
{
"userId": 4,
"isLike": false,
"chat": "밥 먹으러 가자",
"time": "17:22"
}
]
},
{
"userId": 4,
"chatData": [
{ "userId": 4, "isLike": false, "chat": "어디냐", "time": "15:00" },
{ "userId": 0, "isLike": false, "chat": "집", "time": "15:40" },
{ "userId": 4, "isLike": false, "chat": "중도가자", "time": "15:50" },
{ "userId": 4, "isLike": false, "chat": "가자니까", "time": "15:50" }
]
},
{
"userId": 5,
"chatData": [
{ "userId": 5, "isLike": false, "chat": "과제안함?", "time": "18:00" },
{ "userId": 0, "isLike": false, "chat": "할거야", "time": "18:50" },
{ "userId": 5, "isLike": false, "chat": "언제", "time": "18:55" },
{
"userId": 0,
"isLike": false,
"chat": "어쩌라고 화나게하지마",
"time": "19:00"
},
{
"userId": 0,
"isLike": false,
"chat": "카피바라 보고싶다",
"time": "20:00"
}
]
},
{
"userId": 6,
"chatData": [
{
"userId": 6,
"isLike": false,
"chat": "씨프 책 빌려주라",
"time": "06:22"
}
]
}
]
30 changes: 30 additions & 0 deletions public/data/chatListData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"userId": 3,
"userName": "변희민",
"latestMent": "밥 먹으러 가자",
"newNum": 1,
"latestTime": "17:22"
},
{
"userId": 4,
"userName": "장수화",
"latestMent": "가자니까",
"newNum": 2,
"latestTime": "13:22"
},
{
"userId": 5,
"userName": "이서현",
"latestMent": "카피바라 보고싶다",
"newNum": 0,
"latestTime": "06:22"
},
{
"userId": 6,
"userName": "이주원",
"latestMent": "씨프 책 빌려주라",
"newNum": 0,
"latestTime": "06:22"
}
]
9 changes: 9 additions & 0 deletions public/data/userData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{ "id": 0, "userName": "이은비", "comment": "프론트가 미래다" },
{ "id": 1, "userName": "윤서윤", "comment": "디자인이 미래다" },
{ "id": 2, "userName": "김미래", "comment": "내가 미래다" },
{ "id": 3, "userName": "변희민", "comment": "막이래" },
{ "id": 4, "userName": "장수화", "comment": "이걸 안마시네" },
{ "id": 5, "userName": "이서현", "comment": "뭘 할 수 있는데" },
{ "id": 6, "userName": "이주원", "comment": "겠냐고" }
]
Binary file removed public/favicon.ico
Binary file not shown.
Binary file added public/img/Behance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/Github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/Instagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/Surfit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

25 changes: 0 additions & 25 deletions src/App.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

35 changes: 35 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import ChatRoom from './pages/ChatRoom';
import ChatList from './pages/ChatList';
import MyPage from './pages/MyPage';
import FriendList from './pages/FriendList';
import React from 'react';
import styled from 'styled-components';
import theme from './style/theme';
import { Route, Routes } from 'react-router-dom';

function App() {
return (
<Routes>
<Route path="/" element={<FriendList />} />
<Route path="/chatlist" element={<ChatList />} />
<Route path="/chatroom/:userId" element={<ChatRoom />} />
<Route path="/mypage" element={<MyPage />} />
</Routes>
);
}

const Box = styled.div`
width: 23.4375rem;
height: 50.75rem;
border-radius: 1rem;
background: var(--white, #fff);
`;

// const Wrapper = styled.div`
// width: 100%;
// height: 100%;
// display: flex;
// justify-content: center;
// `;

export default App;
121 changes: 121 additions & 0 deletions src/components/ChatBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import React from 'react';
import styled from 'styled-components';
import theme from '../style/theme';
import ProfileSmallIcon from '../static/ProfileSmallIcon';

// 채팅 박스의 입력 프로퍼티를 정의하는 인터페이스
interface ChatBoxProps {
isMe: boolean;
isFirst: boolean;
text: string;
hasTail: boolean;
time: string;
user: string;
}

// ChatBoxProps를 사용하여 채팅 박스 컴포넌트를 정의
const ChatBox: React.FC<ChatBoxProps> = ({
text,
hasTail,
isMe,
time,
isFirst,
user,
}) => {
return (
<Wrapper>
{isMe && (
<MyBox>
<Time>{time}</Time>
<MyChat
style={
isFirst ? { borderRadius: '0.75rem 0rem 0.75rem 0.75rem' } : {}
}
>
{text}
</MyChat>
</MyBox>
)}
{!isMe && !isFirst && (
<YourBox>
<YourChat style={{ marginLeft: '45px' }}>{text}</YourChat>
<Time>{time}</Time>
</YourBox>
)}
{!isMe && isFirst && (
<YourBox>
<div style={{ width: '36px' }}>
<ProfileSmallIcon />
</div>

<div>
<UserName>{user}</UserName>
<YourChat style={{ borderRadius: '0rem 0.75rem 0.75rem 0.75rem' }}>
{text}
</YourChat>
</div>

<Time>{time}</Time>
</YourBox>
)}
</Wrapper>
);
};

const UserName = styled.div`
font-size: ${theme.fonts.caption1};
padding-bottom: 5px;
padding-top: 2px;
`;

const Time = styled.div`
display: flex;
flex-direction: column;
justify-content: flex-end;
font-size: ${theme.fonts.caption2};
color: ${theme.colors.g5};
padding: 5px;
`;

const commonStyles = `
padding: 0.5rem 0.75rem;
justify-content: center;
align-items: center;
display: inline-block;
`;

const MyBox = styled.div`
display: flex;
justify-content: flex-end;
`;

const YourBox = styled.div`
display: flex;
justify-content: flex-start;
gap: 10px;

font-size: ${theme.fonts.body2};
`;
const YourChat = styled.div`
${commonStyles}
border-radius: 0.75rem;
background-color: ${theme.colors.g2};
overflow: hidden;
display: inline-block;
overflow-wrap: break-word;
`;

const MyChat = styled.div`
${commonStyles}
border-radius: 0.75rem;
background-color: ${theme.colors.purple};
color: white;
display: inline-block;
overflow-wrap: break-word;
`;

const Wrapper = styled.div`
margin: 10px;
`;

export default ChatBox;
Loading