-
Notifications
You must be signed in to change notification settings - Fork 12
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주차] 정희수 미션 제출합니다. #16
Open
heeeesoo
wants to merge
15
commits into
CEOS-Developers:master
Choose a base branch
from
heeeesoo:heeeesoo2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2a67610
git branch 새로 팜
heeeesoo 6ff33a8
feat : 페이지 구분
heeeesoo 4eab43e
feat : Header 추가
heeeesoo 1346d7f
feat : Friend page 수정
heeeesoo 29ae0d6
feat : msg 띄우기
heeeesoo 37ff39a
feat : message 보내는 room 틀 구현
heeeesoo af988cc
feat : 채팅 페이지 만들기
heeeesoo cd654cc
feat: 마지막 메세지 뜨기
heeeesoo ae76f1e
feat: setting에 github 링크 추가
heeeesoo 8550abb
feat: 채팅할때 사진 뜨는 기능 추가
heeeesoo f47fa43
fix: key props 에러 해결
heeeesoo 8a9c3c1
feat: 검색 기능 추가
heeeesoo c6a0e37
chore: console.log삭제
heeeesoo 16d783d
chore: search state 변경
heeeesoo 338d626
chore : type 따로 파일 만들기, 이미지 지우기
heeeesoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,5 +47,12 @@ | |
"to":3, | ||
"content":"test6", | ||
"date":"02:20" | ||
}, | ||
{ | ||
"id":7, | ||
"from":0, | ||
"to":4, | ||
"content":"test7", | ||
"date":"02:21" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import styled from 'styled-components'; | ||
import { contentState} from '../../recoil/atom'; | ||
import {useRecoilState,useRecoilValue,} from 'recoil'; | ||
|
||
type ChatItemProps = { | ||
id: number; | ||
|
@@ -11,11 +13,24 @@ type ChatItemProps = { | |
|
||
function ChatItem({id,name,src,number}:ChatItemProps){ | ||
const chatLink = '/room/' + id; | ||
|
||
const [content, setContent] = useRecoilState(contentState); | ||
const result = content.filter(c=>(c.to === id || c.from === id)); | ||
const lastContent = result[result.length-1]; | ||
|
||
return ( | ||
<StyledItem to={chatLink}> | ||
<StyledBox> | ||
<StyledImage width={"45px"} height={"45px"} src={src}/> | ||
{name} | ||
<StyledFontBox> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 큰 styled component 안에 있는 요소들은 선택자로 관리하시면 굳이 새로운 styled component 만들지 않으셔도 돼요!.! |
||
{name} | ||
<StyledFont> | ||
{lastContent.content} | ||
</StyledFont> | ||
</StyledFontBox> | ||
<StyledDate> | ||
{lastContent.date} | ||
</StyledDate> | ||
</StyledBox> | ||
</StyledItem> | ||
); | ||
|
@@ -26,6 +41,18 @@ type StyledProps = { | |
height: string; | ||
} | ||
|
||
const StyledDate = styled.div` | ||
float: right; | ||
object-align: top; | ||
color: gray; | ||
font-size: small; | ||
` | ||
|
||
const StyledFontBox = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width:200px; | ||
` | ||
const StyledFont = styled.div` | ||
font-size: small; | ||
color: gray; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,4 @@ export const contentSelector = selector({ | |
|
||
return result; | ||
}, | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
희수님이 코드리뷰 남겨주신대로 저랑 이 부분이 조금 다르군요..!
저는 기존 과제에서는 concat을 사용했고, 이번 과제에 roomId를 추가하면서 concat 사용이 힘들었는데, 희수님처럼 구현하면 제가 저번 과제 했던 것 처럼 concat을 쉽게 사용할 수 있었겠네요! 방법하나 알아갑니다 👍