Chat.js 1.11 KB
Newer Older
우지원's avatar
ul    
우지원 committed
1
import React from 'react';
2
import { Form, Button, Row } from 'react-bootstrap';
우지원's avatar
ul    
우지원 committed
3
4
5


function Chat(props) {
6
7
8
9
10
11
12
13
14
15
  function handleChange(e) {
    e.preventDefault()
    props.setInner(e.target.value)
    console.log(e.target.value)
  }

  function sendMsgCH(e) {
    props.sendMsg(e)
  }

우지원's avatar
ul    
우지원 committed
16
17
18
  return (
    <div className="chat" id="chat" style={{ border: "2px solid", height: "300%", margin: "1%", borderColor: "#BDBDBD" }}>
      <Button variant="light" onClick={props.handleChatc} >{`<`}</Button>
19
20
21
22
23
24
25
26
27
28
29
30
      <h2>현재 {props.roomName} 입니다.</h2>
      {      props.chatmsg.map((value, index) => (
        <Row key={index} className='ml-3'>
          {props.roomName}에서 보낸 메세지 : {value}
        </Row>
      ))}

      <Form onSubmit={sendMsgCH}>
        <Form.Control name='msg' type='text' onChange={handleChange} />
        <Button variant="primary" type="submit">전송</Button>
      </Form>

우지원's avatar
ul    
우지원 committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
      <Form>
        <Form.Group>
          <Form.Control type="text" />
        </Form.Group>
        <Button variant="primary" type="submit">
          전송
        </Button>
      </Form>
    </div>


  );
}

export default Chat;