blob: 1362544581c18d8754a2b284bd36b84f63846aeb (
plain)
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
|
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import {
createMuiTheme,
ThemeProvider,
makeStyles
} from '@material-ui/core/styles';
import { CssBaseline } from '@material-ui/core';
import teal from '@material-ui/core/colors/teal';
import 'typeface-roboto';
import Header from './Header/Header';
import Feed from './Feed/Feed';
import ProfileInfo from './ProfileInfo/ProfileInfo';
import SignInForm from './Form/SignInForm';
import { User } from './types';
const theme = createMuiTheme({
palette: {
primary: {
main: teal[700]
}
}
});
const useStyles = makeStyles({
root: {
width: theme.spacing(75),
marginTop: theme.spacing(15),
margin: '0 auto'
}
});
const App: React.FC = () => {
const [page, setPage] = useState('feed');
const [user, setUser] = React.useState<User | undefined>();
const classes = useStyles();
return (
<ThemeProvider theme={theme}>
<CssBaseline />
<Header setPage={setPage} />
<div className={classes.root}>
{
page === 'profile'
? (
user
? (
<>
<ProfileInfo id={user?._id || ''} setUser={setUser} />
<Feed page={page} />
</>
)
: <SignInForm setUser={setUser} />
)
: <Feed page={page} />
}
</div>
</ThemeProvider>
);
};
ReactDOM.render(<App />, document.getElementById('root'));
|