RoomSingle.js 1.33 KB
Newer Older
우지원's avatar
우지원 committed
1
import { useEffect, useState } from 'react';
seoyeon's avatar
seoyeon committed
2
import { Link } from 'react-router-dom'
우지원's avatar
우지원 committed
3
4
import userApi from '../../apis/user.api';

Kim, Chaerin's avatar
Kim, Chaerin committed
5

Kim, Chaerin's avatar
Kim, Chaerin committed
6
const RoomSingle = () => {
우지원's avatar
우지원 committed
7
8
  const [room, setRoom] = useState('')
  const id = localStorage.getItem('user');
seoyeon's avatar
seoyeon committed
9
  const channelId = 1
우지원's avatar
우지원 committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23

  async function getRoom(id) {
    try {
      const Room = await userApi.getUser(id)
      setRoom(Room.data.roomNumber)
    } catch (error) {
      // catchErrors(error, setError)
    }
  }

  useEffect(() => {
    getRoom(id)
  }, [id])

Kim, Chaerin's avatar
Kim, Chaerin committed
24
  return (
seoyeon's avatar
seoyeon committed
25
26
27
28
    <Link
      to={`/room/${id}/${channelId}`}
      className="text-decoration-none text-dark"
    >
Kim, Chaerin's avatar
Kim, Chaerin committed
29
      <div
우지원's avatar
우지원 committed
30
        className="d-flex mx-4 my-2 p-2"
seoyeon's avatar
seoyeon committed
31
        style={{ backgroundColor: '#C4C4C4' }}
Kim, Chaerin's avatar
Kim, Chaerin committed
32
      >
seoyeon's avatar
seoyeon committed
33
        <div style={{ width: '37px', height: '37px' }}>
Kim, Chaerin's avatar
Kim, Chaerin committed
34
35
36
          <img
            src="BORA.png"
            className="rounded-circle"
seoyeon's avatar
seoyeon committed
37
            style={{ width: '37px', height: '37px' }}
Kim, Chaerin's avatar
Kim, Chaerin committed
38
39
          />
        </div>
seoyeon's avatar
seoyeon committed
40
41
42
43
44
45
46
47
48
49
50
        <div
          className="mx-3 mt-2"
          style={{
            width: '250px',
            overflow:'scroll',
            whiteSpace: 'nowrap',
            msOverflowStyle:'none',
          }}
        >
          데계 재미있는 수학과 데계데계데계 재미있는 수학과
        </div>
우지원's avatar
우지원 committed
51
        <div className="ms-auto mt-2"> 15/34 </div>
Kim, Chaerin's avatar
Kim, Chaerin committed
52
      </div>
우지원's avatar
우지원 committed
53

seoyeon's avatar
seoyeon committed
54
55
56
    </Link>
  )
}
Kim, Chaerin's avatar
Kim, Chaerin committed
57

seoyeon's avatar
seoyeon committed
58
export default RoomSingle