Skip to content

Commit aa112f1

Browse files
committed
Leaderboard
1 parent f1e10e1 commit aa112f1

File tree

5 files changed

+109
-3
lines changed

5 files changed

+109
-3
lines changed
4.81 KB
Loading
4.95 KB
Loading
5.04 KB
Loading

frontend/src/components/LeaderboardPage.js

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
Stack,
1515
} from '@mui/material';
1616
import QuizLayout from './QuizLayout';
17+
import StarSharp from '../../src/StarSharp.svg';
1718

1819
function LeaderboardPage() {
1920
const { state } = useLocation();
@@ -88,11 +89,76 @@ function LeaderboardPage() {
8889

8990
return (
9091
<QuizLayout>
91-
<Container maxWidth="md">
92-
<Box sx={{ textAlign: 'center', marginTop: 4 }}>
92+
<Container maxWidth="sm" className="main-quiz-container">
93+
<Box sx={{ textAlign: 'center', marginTop: 4, width: '100%' }}>
9394
<Typography variant="h4" gutterBottom>
94-
Leaderboard
95+
LEADERBOARD
9596
</Typography>
97+
<div className="top-scores">
98+
<div className="podium second-place">
99+
<Typography
100+
variant="h5"
101+
gutterBottom
102+
sx={{
103+
marginTop: '80px',
104+
marginLeft: 'auto',
105+
marginRight: 'auto',
106+
}}
107+
>
108+
{leaderboardData[1].Username}
109+
</Typography>
110+
<div class="score">
111+
<img
112+
src={StarSharp}
113+
alt="Score"
114+
style={{ float: 'left', marginLeft: '10px' }}
115+
/>
116+
{leaderboardData[1].Score}
117+
</div>
118+
</div>
119+
<div className="podium first-place">
120+
<Typography
121+
variant="h5"
122+
gutterBottom
123+
sx={{
124+
marginTop: '80px',
125+
marginLeft: 'auto',
126+
marginRight: 'auto',
127+
}}
128+
>
129+
{leaderboardData[0].Username}
130+
</Typography>
131+
<div class="score">
132+
<img
133+
src={StarSharp}
134+
alt="Score"
135+
style={{ float: 'left', marginLeft: '10px' }}
136+
/>
137+
{leaderboardData[0].Score}
138+
</div>
139+
</div>
140+
<div className="podium third-place">
141+
<Typography
142+
variant="h5"
143+
gutterBottom
144+
sx={{
145+
marginTop: '80px',
146+
marginLeft: 'auto',
147+
marginRight: 'auto',
148+
}}
149+
>
150+
{leaderboardData[2].Username}
151+
</Typography>
152+
<div class="score">
153+
<img
154+
src={StarSharp}
155+
alt="Score"
156+
style={{ float: 'left', marginLeft: '10px' }}
157+
/>
158+
{leaderboardData[2].Score}
159+
</div>
160+
</div>
161+
</div>
96162
{leaderboardData.length > 0 ? (
97163
<List component={Paper} sx={{ margin: '0 auto', maxWidth: 600 }}>
98164
{leaderboardData.map((entry, index) => (

frontend/src/index.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,44 @@ code {
8282
margin: 0 auto 0 auto;
8383
line-height: 24px;
8484
margin-bottom: 20px;
85+
}
86+
87+
.top-scores {
88+
display: flex;
89+
padding: var(--3, 24px) 0px;
90+
justify-content: space-between;
91+
align-items: center;
92+
align-self: stretch;
93+
}
94+
95+
.podium {
96+
display: flex;
97+
padding: var(--2, 16px);
98+
flex-direction: column;
99+
align-items: flex-start;
100+
gap: var(--3, 24px);
101+
flex: 1 0 0;
102+
border-radius: var(--borderRadius, 4px);
103+
background: var(--background-paper-elevation-3, #EAEAF0);
104+
text-align: center;
105+
max-width: 130px;
106+
107+
/* elevation/3 */
108+
box-shadow: 0px 1px 8px 0px rgba(0, 0, 0, 0.12), 0px 3px 4px 0px rgba(0, 0, 0, 0.14), 0px 3px 3px -2px rgba(0, 0, 0, 0.20);
109+
}
110+
.first-place {
111+
background-image: url('./assets/images/FirstPlace.png');
112+
background-position: 50% 10%;
113+
background-repeat: no-repeat;
114+
margin-top: -20px;
115+
}
116+
.second-place {
117+
background-image: url('./assets/images/SecondPlace.png');
118+
background-position: 50% 10%;
119+
background-repeat: no-repeat;
120+
}
121+
.third-place {
122+
background-image: url('./assets/images/ThirdPlace.png');
123+
background-position: 50% 10%;
124+
background-repeat: no-repeat;
85125
}

0 commit comments

Comments
 (0)