Skip to content

Commit 7f75655

Browse files
committed
✨ feat: add podium on result page
1 parent 8fb2b19 commit 7f75655

File tree

4 files changed

+59
-10
lines changed

4 files changed

+59
-10
lines changed

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module.exports = {
2222
ecmaVersion: 2018,
2323
sourceType: 'module',
2424
allowImportExportEverywhere: true,
25+
project: './tsconfig.json',
26+
tsconfigRootDir: '.',
2527
},
2628
plugins: [
2729
'react',

src/pages/fighters/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function Fighters() {
6363
variables: {
6464
owner,
6565
repoName,
66-
pullCount,
66+
pullCount: pullCount > 100 ? 100 : pullCount,
6767
},
6868
});
6969

src/pages/result/index.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,16 @@ const Result: FC = () => {
3535
</div>
3636
<img src={trophy} alt="Trophy icon" />
3737
</Header>
38-
<Podium />
38+
<Podium>
39+
{placing.slice(0, 3).map((fighter, index) => (
40+
<li key={`podium_${fighter.id}`}>
41+
<strong>
42+
{index + 1}º - {fighter.points}
43+
</strong>
44+
{fighter.author.login}
45+
</li>
46+
))}
47+
</Podium>
3948
<Rank>
4049
{placing.map((fighter, index) => (
4150
<Position key={fighter.id}>

src/pages/result/styles.ts

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,51 @@ export const Header = styled.header`
2929
}
3030
`;
3131

32-
export const Podium = styled.section``;
32+
export const Podium = styled.ol`
33+
display: grid;
34+
grid-template-columns: repeat(3, auto);
35+
position: relative;
36+
37+
max-width: 611px;
38+
margin: 30px auto 60px auto;
39+
40+
li {
41+
font-size: 1.8rem;
42+
text-align: center;
43+
font-weight: 700;
44+
45+
strong {
46+
display: block;
47+
margin-bottom: 8px;
48+
color: ${({ theme }) => theme.colors.active};
49+
}
50+
}
51+
52+
li:nth-of-type(1) {
53+
grid-column: 2/2;
54+
}
55+
56+
li:nth-of-type(2) {
57+
grid-column: 1/1;
58+
}
59+
60+
li:nth-of-type(3) {
61+
grid-column: 3/3;
62+
}
63+
64+
&::after {
65+
content: '';
66+
position: absolute;
67+
background: ${({ theme }) => theme.colors.secundaryText};
68+
69+
left: 0;
70+
bottom: -30px;
71+
72+
height: 2px;
73+
width: 100%;
74+
border-radius: 1px;
75+
}
76+
`;
3377

3478
export const Rank = styled.ol`
3579
display: flex;
@@ -50,13 +94,7 @@ export const Position = styled(card).attrs({
5094
5195
transition: 0.2s ease;
5296
53-
&:first-of-type {
54-
margin-top: 64px;
55-
}
56-
57-
& + & {
58-
margin-top: 32px;
59-
}
97+
margin-top: 32px;
6098
6199
> span {
62100
font-size: 4.8rem;

0 commit comments

Comments
 (0)