Overnap

Refresh 컴포넌트 추가 및 Rooms에 적용

1 +import React from 'react';
2 +
3 +interface RefreshProps {
4 + refreshRooms: () => void
5 +}
6 +
7 +export const Refresh: React.FC<RefreshProps> = ({ refreshRooms }) => {
8 + return (
9 + <button className="bg-green-500 active:bg-green-600
10 + text-white uppercase text-xl
11 + w-10 h-8 pb-0.5 ml-3 rounded shadow round
12 + outline-none focus:outline-none hover:shadow-md
13 + ease-linear transition-all duration-100"
14 + type="button"
15 + onClick={() => refreshRooms()}>⟳</button>
16 + );
17 +}
...@@ -2,6 +2,7 @@ import React, { useCallback, useContext, useEffect, useState } from 'react'; ...@@ -2,6 +2,7 @@ import React, { useCallback, useContext, useEffect, useState } from 'react';
2 import { useHistory } from 'react-router'; 2 import { useHistory } from 'react-router';
3 import { Main } from '../components/common/Main'; 3 import { Main } from '../components/common/Main';
4 import { MessageResponse, MessageType, RawMessage } from '../components/common/types'; 4 import { MessageResponse, MessageType, RawMessage } from '../components/common/types';
5 +import { Refresh } from '../components/rooms/Refrsh';
5 import { RoomBlock } from '../components/rooms/RoomBlock'; 6 import { RoomBlock } from '../components/rooms/RoomBlock';
6 import { Room } from '../components/rooms/types'; 7 import { Room } from '../components/rooms/types';
7 import SocketContext from '../contexts/SocketContext'; 8 import SocketContext from '../contexts/SocketContext';
...@@ -30,6 +31,9 @@ export const Rooms: React.FC = () => { ...@@ -30,6 +31,9 @@ export const Rooms: React.FC = () => {
30 31
31 return ( 32 return (
32 <Main> 33 <Main>
34 + <div className='mt-8'>
35 + <Refresh refreshRooms={refreshRooms}/>
36 + </div>
33 <div className='mt-auto w-screen flex flex-col items-center'> 37 <div className='mt-auto w-screen flex flex-col items-center'>
34 {rooms.map((room) => (<RoomBlock key={room.uuid} room={room} />))} 38 {rooms.map((room) => (<RoomBlock key={room.uuid} room={room} />))}
35 </div> 39 </div>
......