-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
54 lines (43 loc) · 1.86 KB
/
App.tsx
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
import { Container, Stack, Typography, useTheme } from '@mui/material'
import { JavaScriptLogo } from './JavaScriptLogo'
import { Start } from './Start'
import { Game } from './Game'
import { useQuestionStore } from './store/questions'
import useMediaQuery from "@mui/material/useMediaQuery"
import { useQuestionData } from "./hooks/useQuestionData"
import { Results } from './Results'
import './App.css'
function App() {
const questions = useQuestionStore(state => state.questions)
const { unanswered } = useQuestionData()
const theme = useTheme()
const medium = useMediaQuery(theme.breakpoints.up("md"));
return (
<main>
<Container maxWidth='sm'>
<Stack direction='row' gap={2} alignItems='center' justifyContent='center'>
<JavaScriptLogo />
<Typography variant={medium ? 'h2' : 'h5'} component='h1'>
JavaScript Quiz
</Typography>
</Stack>
{questions.length === 0 && <Start />}
{questions.length > 0 && unanswered > 0 && <Game />}
{questions.length > 0 && unanswered === 0 && <Results />}
<strong style={{ display: 'block', fontSize: '14px' }}>
Project based on <a style={{ color: 'yellow' }} href='https://midu.dev/'>¡midudev!</a>
</strong>
<strong style={{ display: 'block', fontSize: '14px' }}>
¿Do you want to learn React ⚛️? <a style={{ color: 'yellow' }} href='https://github.com/midudev/aprendiendo-react'>¡Go ahead!</a>
</strong>
<strong style={{ display: 'block', fontSize: '14px', marginTop: '16px' }}>
This application is developed using TypeScript + Zustand - {' '}
<a style={{ color: 'yellow' }} href='https://github.com/oscarossesa/zustand-quiz'>
Go to code
</a>
</strong>
</Container>
</main>
)
}
export default App