Commit 3e091bf2 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

안내메시지

parent 7a5a52a5
...@@ -12,7 +12,7 @@ const INIT_CHAT = { ...@@ -12,7 +12,7 @@ const INIT_CHAT = {
time: '' time: ''
} }
function Chat(props) { function Chat(props) {
const [sender, setSender] = useState([]) //const [sender, setSender] = useState([])
//const [roomName, setRoomName] = useState('') //const [roomName, setRoomName] = useState('')
const [inner, setInner] = useState(['']) const [inner, setInner] = useState([''])
...@@ -148,7 +148,13 @@ function Chat(props) { ...@@ -148,7 +148,13 @@ function Chat(props) {
: null} : null}
{chat.map((value, index) => { {chat.map((value, index) => {
if (!(value.msg === '')) { if (!(value.msg === '')) {
if (!(value.sender === user.nickname)) { if (value.sender === "system") {
return (
<Row className='border' style={{ background: "#FFFAFA"}}>
{value.msg}
</Row>
)
} else if (!(value.sender === user.nickname)) {
return ( return (
<Row key={index} className='m-1' > <Row key={index} className='m-1' >
<Col xs={2}> <Col xs={2}>
...@@ -163,10 +169,6 @@ function Chat(props) { ...@@ -163,10 +169,6 @@ function Chat(props) {
</Col> </Col>
</Row> </Row>
) )
} else if (sender[index] === "") {
return (
{ value }
)
} else { } else {
return ( //내가 보낸 메시지 return ( //내가 보낸 메시지
<Row key={index} className='m-1 justify-content-end'> <Row key={index} className='m-1 justify-content-end'>
...@@ -186,7 +188,7 @@ function Chat(props) { ...@@ -186,7 +188,7 @@ function Chat(props) {
</Container > </Container >
<Form onSubmit={sendMsgCH} fluid> <Form onSubmit={sendMsgCH} fluid>
<Form.Group className='d-flex flex-wrap-nowrap justify-content-center m-3'> <Form.Group className='d-flex flex-wrap-nowrap justify-content-center m-3'>
<Form.Control className='border border-warning' name='chat' type="text" value={inner} onChange={handleChange} style={{ width: '85%'}} /> <Form.Control className='border border-warning' name='chat' type="text" value={inner} onChange={handleChange} style={{ width: '85%' }} />
<Button variant="warning" type="submit" disabled={disabled} style={{ width: '10%' }}> <Button variant="warning" type="submit" disabled={disabled} style={{ width: '10%' }}>
전송 전송
</Button> </Button>
......
...@@ -149,7 +149,6 @@ function Home() { ...@@ -149,7 +149,6 @@ function Home() {
sendInfo: { sendInfo: {
msg: sysmsg, msg: sysmsg,
sender: "system", sender: "system",
// time: singleTime
} }
}) })
setSysmsg('') setSysmsg('')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment