Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e441971
<feat> 하단 입력창 생성
GeonHeeAhn Mar 28, 2021
d4c2c5b
style : 파일명 변경
GeonHeeAhn Mar 28, 2021
19e94f9
feat 상하단 고정, 스크롤 생성, 프로필 정보 입력
GeonHeeAhn Mar 31, 2021
b746733
feat : 프로필 클릭 시 변경
GeonHeeAhn Mar 31, 2021
3434a4e
feat : 페이지 제목 변경, margin 값 제거
GeonHeeAhn Mar 31, 2021
63ff16a
feat : input값 전송, 프로필 맞춰서 창에 띄우기(사진안뜸)
GeonHeeAhn Mar 31, 2021
9f99612
feat: 새로운 메세지 프로필 오류 해결
GeonHeeAhn Mar 31, 2021
f0ed9ad
feat: 새로운 메세지 프로필 오류 해결, 공백 입력 불가(alert는 아직 안됨)
GeonHeeAhn Apr 2, 2021
e12e220
Merge branch 'main' of https://github.com/GeonHeeAhn/react-messenger-…
GeonHeeAhn Apr 2, 2021
b3abbfc
feat: 공백 입력시 alert
GeonHeeAhn Apr 2, 2021
415635d
style : 상단 밑 공백 css 수정
GeonHeeAhn Apr 2, 2021
3868e6a
style : 페이지 인덱스 icon 수정, 메세지 전송 창 css 수정
GeonHeeAhn Apr 2, 2021
7fd72e7
feat : 공백 alert 에러 수정
GeonHeeAhn Apr 2, 2021
60c7b4b
style: input창 css 수정
GeonHeeAhn Apr 2, 2021
ee89e9c
feat : 메세지가 보내진 시간 출력
GeonHeeAhn Apr 2, 2021
6d88e74
style : css 수정 (input창, 채팅배경 설정, 프로필에 이미지 추가)
GeonHeeAhn Apr 2, 2021
72c6824
feat: 시간 출력 코드 수정( 10분 이하일 때 두자리수로 나타내도록)
GeonHeeAhn Apr 2, 2021
6466624
feat: 상단바 생성, 현재 시간 추가
GeonHeeAhn Apr 2, 2021
596319a
fix : 불필요한 코드 및 주석 제거
GeonHeeAhn Apr 2, 2021
aa53dd9
vercel 오류 나서 올리는 커밋
GeonHeeAhn Apr 2, 2021
259d0f5
vercel 오류 나서 올리는 커밋
GeonHeeAhn Apr 2, 2021
0e95196
오류 나서 올리는 커밋...ㅠㅠ
GeonHeeAhn Apr 2, 2021
fa907e1
fix : vercel 오류 위한 커밋2...ㅠㅠ
GeonHeeAhn Apr 2, 2021
06fa9d2
feat : 리액트 라우터 설치
GeonHeeAhn Apr 7, 2021
e223644
style : 프리티어 적용
GeonHeeAhn Apr 7, 2021
3fc4f63
refactor : 폴더 생성 후 삽입
GeonHeeAhn Apr 7, 2021
e0faa9b
feat: 기본 구조 세팅
GeonHeeAhn Apr 7, 2021
e17d656
fix : 네비게이션 바 + 화면 구성
GeonHeeAhn Apr 7, 2021
4410919
feat : search용 버튼, input 박스 구현
GeonHeeAhn Apr 7, 2021
4a6b30e
style : 메인화면 css 수정 (네비게이션바와 친구목록 창 중첩되는 문제)
GeonHeeAhn Apr 8, 2021
9681450
feat: setting 페이지 레이아웃
GeonHeeAhn Apr 13, 2021
17be1c8
feat: 스크롤 코드 생성
GeonHeeAhn Apr 13, 2021
1df408d
feat: 검색 기능 생성
GeonHeeAhn Apr 13, 2021
e1ff5bd
feat: 채팅목록 레이아웃 + 데이터 props로 받아 출력 성공
GeonHeeAhn Apr 13, 2021
8fe7a87
feat:채팅목록에서 각각의 채팅방으로 이동하는 기능 구현
GeonHeeAhn May 7, 2021
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
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi":true,
"singleQuote": true
}
318 changes: 120 additions & 198 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@testing-library/user-event": "^12.2.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.0",
"styled-components": "^5.2.1",
"web-vitals": "^0.2.4"
Expand Down
Binary file added public/battery.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/bell.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/calendar.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/chat.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/heart_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="%PUBLIC_URL%/myMelody.jpg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand All @@ -24,9 +24,15 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>12기 프론트 투표</title>
<title>♥ messenger ♥</title>
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<body >
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
Expand Down
Binary file added public/kakaoImg.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/myMelody-bg.jpg
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/myMelody-profile.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/myMelody.jpg
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/person.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/profile1.jpg
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/profile2.jpg
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/search.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/setting.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/settingImg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 41 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
import React from 'react';
import { React, useState } from 'react';
import styled from 'styled-components';
import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom';
import { chatData } from './Data';
import Chat from './chat/Index';
import Main from './main/Index';
import ChatList from './chatList/Index';
import Setting from './setting/Index';
import MenuBar from './MenuBar';

function App() {
const Container = styled.div`
display: flex;
flex-direction: row;
`;

function ChatOutput(){
let {user} = useParams();
return <div> {user} </div>;
}
export default function App(props) {
const [list, setList] = useState(chatData);
return (
<div > 12기 프론트엔드 개발팀장 투표 ^.^
</div>
<Router>
<Container>
<Link to="/"></Link>
<Link to="/chat"></Link>
<Link to="/chatlist"></Link>
<Link to="/setting"></Link>
<Route path={['/', '/chatlist', '/setting']} component={MenuBar} />

<Switch>
<Route exact path="/" component={Main} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

나중에 다른 홈페이지/랜딩페이지 추가를 대비해서 기본 path (/)는 랜딩페이지로, 친구목록은 다른 route를 써서 사용했으면 좋았을 것 같아요!

<Route path="/chatlist/:id" component={Chat} />
{/* <Route path="/chat/:user" component={Chat} />
<ChatOutput/> */}
<Route
path="/chatlist"
render={(props) => <ChatList {...props} list={list} />}
/>
<Route path="/setting" component={Setting} />
</Switch>
</Container>
</Router>
);
}

export default App;
69 changes: 69 additions & 0 deletions src/Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//이름 채팅데이터 아이디 프로필사진

//아이디 내용

export const userData = [
{
name: '안건희',
id: 0,
profileImg: `${process.env.PUBLIC_URL}/profile1.jpg`,
},
{
name: '고양이',
id: 1,
profileImg: `${process.env.PUBLIC_URL}/profile1.jpg`,
},
{
name: '야옹이',
id: 2,
profileImg: `${process.env.PUBLIC_URL}/profile1.jpg`,
},
{
name: '겸댕',
id: 3,
profileImg: `${process.env.PUBLIC_URL}/profile1.jpg`,
},
];

export const chatData = [
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

여기도 채팅...대박....저는 귀찮..아서 채팅을 다 안저장햇는데..해야겠어요ㅠㅠ

{
user:userData[0],
id:0,
chatText:[{
user: userData[0],
text:'이렇게 하면 되나'
},{
user: userData[1],
text:'웅야'
},{
user: userData[1],
text:'그렇게 하면 돼'
}]
},{
user:userData[1],
id:1,
chatText:[{
user: userData[0],
text:'이렇게 하면 되나'
},{
user: userData[1],
text:'웅야'
},{
user: userData[1],
text:'그렇게 하면 돼'
}]
},{
user:userData[2],
id:2,
chatText:[{
user: userData[2],
text:'이렇게 하면 되나'
},{
user: userData[1],
text:'웅야'
},{
user: userData[2],
text:'그렇게 하면 돼'
}]
},
];
53 changes: 53 additions & 0 deletions src/MenuBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import styled from 'styled-components';
import { Link } from 'react-router-dom';

const Container = styled.div`
position: fixed;
width: 70px;
height: calc(100% - 50px);
background-color: rgb(66, 54, 48);
padding-top: 25px;
display:flex;
flex-direction:column;
align-content: center;
justify-content: space-between;
padding-bottom: 25px;
`;

const Contents = styled.img`
margin-left: 22px;
margin-top: 10px;
margin-bottom: 15px;
width: 26px;
height: 26px;
`;

const MiniContents = styled.img`
width: 18px;
height:18px;
margin-left: 26px;
margin-top:8px;
margin-bottom:8px;
`;
export default function MenuBar() {
return (
<Container>
<div>
<Link to="/">
<Contents src={process.env.PUBLIC_URL + 'person.png'} />
</Link>
<Link to="/chatlist">
<Contents src={process.env.PUBLIC_URL + 'chat.png'} />
</Link>
<Link to="/setting">
<Contents src={process.env.PUBLIC_URL + 'setting.png'} />
</Link>
</div>
<div>
<MiniContents src={process.env.PUBLIC_URL + `calendar.png`}/>
<MiniContents src={process.env.PUBLIC_URL + `bell.png`}/>
<MiniContents src={process.env.PUBLIC_URL + `settingImg.png`}/>
</div>
</Container>
);
}
53 changes: 53 additions & 0 deletions src/chat/ChatInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import styled from 'styled-components';
import React from 'react';

const Box = styled.form`
display: flex;
flex-direction: row;
align-items: center;
height: 70px;
width: 100%;
bottom: 0px;
position: fixed;
background-color: rgb(237, 232, 234);
`;
const Input = styled.input`
height: 50px;
border-radius: 30px;
margin-left: 5%;
flex-grow: 5;
border: 1px solid rgb(204, 194, 180);
:focus{
border: 1px solid rgb(204, 194, 180);;
outline: none;
}
`;

const Button = styled.button`
height: 50px;
flex-grow: 1;
margin-left: 10px;
margin-right: 5%;
border-radius: 30px;
background-color: rgb(222, 189, 164);
border: none;
:focus{
border: none;
outline: none;
}
`;

export default function ChatInput(props){
const {message,handleSubmit,handleChangeInput} = props;
return(
<Box onSubmit = {handleSubmit}>
<Input
type="text"
value={message}
placeholder = ' Please enter a message'
onChange = {handleChangeInput}
/>
<Button type="submit">전송</Button>
</Box>
)
}
44 changes: 44 additions & 0 deletions src/chat/ChatList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import styled from 'styled-components';
import MessageItem from './MessageItem';
import { useEffect, useRef } from 'react';
import {chatData} from '../Data';

const Container = styled.div`
display: flex;
flex-direction: column;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
width: 100%;
top: 120px;
bottom: 70px;
background-image: url('./heart_bg.png');
`;

export default function ChatList(props) {

const containerRef = useRef(null);
const list = props.chatData.chatText.map((item) => {
return <MessageItem chatItem={item} />;
});

useEffect(() => {
containerRef.current.scrollTo(0, containerRef.current.scrollHeight);
}, [list]);

return <Container ref={containerRef}>{list}</Container>;
}
// export default function ChatList(props) {
// const { chatData } = props;
// const containerRef = useRef(null);
// const list = chatData.map((item) => {
// return <MessageItem chatItem={item} />;
// });

// useEffect(() => {
// containerRef.current.scrollTo(0, containerRef.current.scrollHeight);
// }, [list]);

// return <Container ref={containerRef}>{list}</Container>;
// }

Comment on lines +31 to +44
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

주석은 지우는게 가독성에 더 좋을 것 같아요!

Loading