OpenList.js 707 Bytes
Newer Older
Choi Ga Young's avatar
Choi Ga Young committed
1
import React from 'react'
우지원's avatar
ul    
우지원 committed
2
import { ListGroup } from 'react-bootstrap';
Choi Ga Young's avatar
Choi Ga Young committed
3
import "../Pages/Home.css";
우지원's avatar
ul    
우지원 committed
4

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

Soo Hyun Kim's avatar
Soo Hyun Kim committed
7
  function enterChatRoomCH(e) {
Choi Ga Young's avatar
Choi Ga Young committed
8
    if (props.roomCode) {
Soo Hyun Kim's avatar
Soo Hyun Kim committed
9
10
      props.closeChatRoom(props.roomCode)
    }
11
    const roomCode = e.target.name
Choi Ga Young's avatar
Choi Ga Young committed
12
    props.openListroom(roomCode)
13
    props.setRoomCode(roomCode)
Soo Hyun Kim's avatar
soo0115    
Soo Hyun Kim committed
14
15
  }

우지원's avatar
ul    
우지원 committed
16
  return (
Soo Hyun Kim's avatar
Soo Hyun Kim committed
17
    <div style={{overflow: 'auto', height: "80vh"}}>
18
      {props.openlist.map((item, index) =>
우지원's avatar
ul    
우지원 committed
19
        <ListGroup key={index}>
Choi Ga Young's avatar
Choi Ga Young committed
20
          <ListGroup.Item action onClick={enterChatRoomCH} name={item.roomId} className='rounded-0'>
Choi Ga Young's avatar
Choi Ga Young committed
21
            {item.roomName}
우지원's avatar
ul    
우지원 committed
22
23
24
25
26
27
28
29
          </ListGroup.Item>
        </ListGroup>
      )}
    </div>
  )
}

export default OpenList