Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
messenger
Commits
2fb46987
Commit
2fb46987
authored
Jan 18, 2021
by
Yoon, Daeki
😅
Browse files
chat inner debut
parent
0a02c1c5
Changes
3
Show whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
2fb46987
...
...
@@ -6,7 +6,7 @@ function Chat(props) {
let
defaultname
=
sessionStorage
.
getItem
(
'
name
'
);
const
[
inner
,
setInner
]
=
useState
([
''
])
const
[
chat
,
setChat
]
=
useState
([
inner
])
//object로 key는 보낸사람 value는 메세지
const
[
chat
,
setChat
]
=
useState
([])
//object로 key는 보낸사람 value는 메세지
function
handleChange
(
e
)
{
e
.
preventDefault
()
...
...
@@ -33,9 +33,10 @@ function Chat(props) {
<
div
className
=
"
chat
"
id
=
"
chat
"
style
=
{{
border
:
"
2px solid
"
,
height
:
"
300%
"
,
margin
:
"
1%
"
,
borderColor
:
"
#BDBDBD
"
}}
>
<
h2
>
현재
{
props
.
roomName
}
입니다
.
<
/h2
>
{
chat
.
map
((
value
,
index
)
=>
{
if
(
!
(
value
==
''
))
{
// console.log(`value=${value}=`)
{
console
.
log
(
chat
)}
{
chat
.
map
((
value
,
index
)
=>
{
if
(
!
(
value
===
''
))
{
console
.
log
(
'
value=
'
,
value
)
return
<
Row
key
=
{
index
}
className
=
'
ml-3
'
>
{
props
.
roomName
}
에서
{
defaultname
}
님이
보낸
메세지
:
{
value
}
<
/Row
>
...
...
client/src/Components/ClosedList.js
View file @
2fb46987
...
...
@@ -24,7 +24,7 @@ function ClosedList(props) {
console
.
log
(
e
.
target
.
name
)
console
.
log
(
e
.
target
)
const
roomName
=
e
.
target
.
name
props
.
enterChat
r
oom
(
roomName
)
// 각각의 room으로 들어가도록 설정해야 함
props
.
enterChat
R
oom
(
roomName
)
// 각각의 room으로 들어가도록 설정해야 함
props
.
setRoomName
(
roomName
)
}
...
...
client/src/Pages/HomePage.js
View file @
2fb46987
...
...
@@ -36,7 +36,7 @@ function Home() {
//SOCKET 관련 시작
function
enterChat
r
oom
(
rName
)
{
//방 입장하기
function
enterChat
R
oom
(
rName
)
{
//방 입장하기
socket
.
emit
(
'
joinRoom
'
,
rName
)
console
.
log
(
`joinRoom :
${
rName
}
입장`
)
}
...
...
@@ -92,7 +92,7 @@ function Home() {
<
/Col
>
<
/Row
>
<
RoomMake
showModal
=
{
showModal
}
handleCloseModal
=
{
handleCloseModal
}
/
>
<
EnterRoom
showEnter
=
{
showEnter
}
enterChatRoom
=
{
enterChat
r
oom
}
handleCloseEnter
=
{
handleCloseEnter
}
/
>
<
EnterRoom
showEnter
=
{
showEnter
}
enterChatRoom
=
{
enterChat
R
oom
}
handleCloseEnter
=
{
handleCloseEnter
}
/
>
<
/
>
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment