-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
834c94b
commit a7864fb
Showing
13 changed files
with
190 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import { css } from '@emotion/react'; | ||
import { useRecoilState } from 'recoil'; | ||
|
||
import { roomInfoState } from '../../recoil/roominfo/atom'; | ||
import { VariablesCSS } from '../../styles/VariablesCSS'; | ||
import { ChatArray } from '../../type'; | ||
import { ChatForm } from './ChatForm'; | ||
import { Chats } from './Chats'; | ||
|
||
type PropsType = { | ||
publishChat: (content: string) => void; | ||
chats: ChatArray; | ||
setChats: React.Dispatch<React.SetStateAction<ChatArray>>; | ||
}; | ||
|
||
export const Chat = ({ publishChat, chats, setChats }: PropsType) => { | ||
/* 방 정보 */ | ||
const [roomInfo] = useRecoilState(roomInfoState); | ||
|
||
// 내가 살아있는지 | ||
const isAlive = roomInfo?.isAlive; | ||
|
||
return ( | ||
<> | ||
{/* 채팅목록 */} | ||
<div css={middle}> | ||
<Chats chats={chats} setChats={setChats} /> | ||
</div> | ||
|
||
{/* 살아있는 경우에만 input창이 보인다. */} | ||
{isAlive && <ChatForm publishChat={publishChat} />} | ||
</> | ||
); | ||
}; | ||
|
||
const middle = css` | ||
height: calc(100% - ${VariablesCSS.top} - 55px - 20px); | ||
overflow: scroll; | ||
-ms-overflow-style: none; | ||
scrollbar-width: none; | ||
&::-webkit-scrollbar { | ||
display: none; | ||
} | ||
`; |
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
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
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
Oops, something went wrong.