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

4
function ClosedList(props) {
Choi Ga Young's avatar
Choi Ga Young committed
5
6
7
8
  const [list, setList] = useState([
    { room: '테스트 방1', memnum: 5, admin: '가영' },
    { room: '테스트 방2', memnum: 4, admin: '수현' }]
  );
9
10
11
12
13
14
15
  function enterChatroomCH(e) {
    const roomName = e.target.name
    props.enterChatroom(roomName) // 각각의 room으로 들어가도록 설정해야 함
    props.setRoomName(roomName)
    props.clearChat()
  }

Choi Ga Young's avatar
Choi Ga Young committed
16
17
  return (
    <div>
18
19
20
21
22
23
24
25
26
27
28
29
      <Row>
        {list.map((list, index) =>
          <ListGroup key={index}>
            <ListGroup.Item action onClick={enterChatroomCH} name={list.room}>
              {list.room}
            </ListGroup.Item>
          </ListGroup>
        )}
      </Row>
      <Col>

      </Col>
Choi Ga Young's avatar
Choi Ga Young committed
30
31
32
33
34
    </div>
  )
}

export default ClosedList