ClosedList.js 927 Bytes
Newer Older
Choi Ga Young's avatar
Choi Ga Young committed
1
import React from 'react'
Choi Ga Young's avatar
Choi Ga Young committed
2
import { Badge, ListGroup } from 'react-bootstrap';
Choi Ga Young's avatar
Choi Ga Young committed
3

4
function ClosedList(props) {
5

Soo Hyun Kim's avatar
Soo Hyun Kim committed
6
  function enterChatRoomCH(e) {
7
    if (props.roomCode) {
Soo Hyun Kim's avatar
Soo Hyun Kim committed
8
9
      props.closeChatRoom(props.roomCode)
    }
10
    const roomCode = e.target.name
Soo Hyun Kim's avatar
Soo Hyun Kim committed
11
    const roomName = e.target.value
12
    props.enterChatRoom(roomCode)
Soo Hyun Kim's avatar
Soo Hyun Kim committed
13
    props.setRoomCode(roomCode)
Soo Hyun Kim's avatar
Soo Hyun Kim committed
14
    props.setRoomName(roomName)
15

16
  }
우지원's avatar
수정    
우지원 committed
17

Choi Ga Young's avatar
Choi Ga Young committed
18
  return (
Soo Hyun Kim's avatar
Soo Hyun Kim committed
19
20
    <div style={{height: "80vh"}}>
    <div style={{overflow: 'auto', height:"100%"}}>
21
      {props.closedlist.map((item, index) =>
Choi Ga Young's avatar
Choi Ga Young committed
22
        <ListGroup key={index}>
Soo Hyun Kim's avatar
Soo Hyun Kim committed
23
          <ListGroup.Item action onClick={enterChatRoomCH} name={item.roomId} value={item.roomName}>
Choi Ga Young's avatar
Choi Ga Young committed
24
            {item.roomName}
Choi Ga Young's avatar
Choi Ga Young committed
25
            {/* {[index] ? <Badge className='ml-2' pill variant='danger'>{unreadnumber[index]}</Badge> : ''} */}
Choi Ga Young's avatar
Choi Ga Young committed
26
27
          </ListGroup.Item>
        </ListGroup>
28
29
      )
      }
30
    </div >
Soo Hyun Kim's avatar
Soo Hyun Kim committed
31
    </div>
Choi Ga Young's avatar
Choi Ga Young committed
32
33
34
  )
}

Soo Hyun Kim's avatar
Soo Hyun Kim committed
35
export default ClosedList