OpenList.js 774 Bytes
Newer Older
Choi Ga Young's avatar
Choi Ga Young committed
1
import React from 'react'
우지원's avatar
ul    
우지원 committed
2
3
import { ListGroup } from 'react-bootstrap';

Soo Hyun Kim's avatar
soo0115    
Soo Hyun Kim committed
4
5
function OpenList(props) {

Soo Hyun Kim's avatar
Soo Hyun Kim committed
6
  function enterChatRoomCH(e) {
Soo Hyun Kim's avatar
Soo Hyun Kim committed
7
8
9
10
    if (props.roomCode){
      props.closeChatRoom(props.roomCode)
    }
    
Choi Ga Young's avatar
Choi Ga Young committed
11
    console.log('e확인', e.target)
12
    const roomCode = e.target.name
Choi Ga Young's avatar
Choi Ga Young committed
13
14
    // props.enterChatRoom(roomCode) // 각각의 room으로 들어가도록 설정해야 함
    props.openListroom(roomCode)
15
    props.setRoomCode(roomCode)
Soo Hyun Kim's avatar
soo0115    
Soo Hyun Kim committed
16
17
18
    // props.clearChat()
  }

우지원's avatar
ul    
우지원 committed
19
20
  return (
    <div>
21
      {props.openlist.map((item, index) =>
우지원's avatar
ul    
우지원 committed
22
        <ListGroup key={index}>
23
          <ListGroup.Item action onClick={enterChatRoomCH} name={item.roomId}>
Choi Ga Young's avatar
Choi Ga Young committed
24
            {item.roomName}
우지원's avatar
ul    
우지원 committed
25
26
27
28
29
30
31
32
          </ListGroup.Item>
        </ListGroup>
      )}
    </div>
  )
}

export default OpenList