-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
82 lines (72 loc) · 1.84 KB
/
Copy pathApp.js
File metadata and controls
82 lines (72 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import './App.css';
import Chat from "./components/Chat";
import Login from "./components/Login";
import Header from "./components/Header";
import Sidebar from "./components/Sidebar";
import styled from "styled-components";
import {BrowserRouter as Router,Routes,Route} from "react-router-dom";
import { useAuthState } from "react-firebase-hooks/auth";
import {auth} from "./Firebase";
import Spinner from "react-spinkit";
function App() {
const [user, loading] = useAuthState(auth);
if(loading){
return(
<AppLoading>
<AppLoadingContainer>
<img src="https://cdn.mos.cms.futurecdn.net/SDDw7CnuoUGax6x9mTo7dd.jpg" alt=""/>
<Spinner
name="ball-spin-fade-loader"
color="purple" fadeIn="none"
/>
</AppLoadingContainer>
</AppLoading>
);
}
return (
<div className="app">
<Router>
{!user ?(
<Login/>):(
<>
<Header/>
<AppBody>
<Sidebar/>
<Routes>
<Route exact path="/"
element={<Chat/>}>
</Route>
<Route path="/chat"
element={<Chat/>}>
</Route>
</Routes>
</AppBody>
</>
)}
</Router>
</div>
);
}
export default App;
const AppBody = styled.div`
display:flex;
height:100vh`;
const AppLoading = styled.div`
display:grid;
place-items:center;
height:100vh;
width:100%;
`;
const AppLoadingContainer = styled.div`
text-align:center;
padding-bottom:100px;
display:flex;
flex-direction:column;
justify-content:center;
align-items:center;
>img{
height:100px;
padding:20px;
margin-bottom:40px;
}
`;