generated from UoaWDCC/react-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added in carosoul section, but needs fix up.
- Loading branch information
1 parent
cfae14a
commit e707319
Showing
5 changed files
with
135 additions
and
5 deletions.
There are no files selected for viewing
11 changes: 9 additions & 2 deletions
11
frontend2/components/Ranks/LeaderBoard/LeaderBoard.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.ball { | ||
height: rem(140px); | ||
width: rem(140px); | ||
border-radius: rem(70px); | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: flex-start; | ||
background-size: cover; | ||
background-position: center; | ||
} | ||
|
||
.ballContainer{ | ||
background-color: transparent; | ||
} | ||
|
||
.title { | ||
font-weight: 900; | ||
color: var(--mantine-color-white); | ||
line-height: 1.2; | ||
font-size: rem(32px); | ||
margin-top: var(--mantine-spacing-xs); | ||
} | ||
|
||
.category { | ||
color: var(--mantine-color-white); | ||
opacity: 0.7; | ||
font-weight: 700; | ||
text-transform: uppercase; | ||
} | ||
|
||
.button { | ||
margin-top: 1rem; | ||
} | ||
|
||
.carosoul { | ||
background-colour: #87562A; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { Carousel } from '@mantine/carousel'; | ||
import { useMediaQuery } from '@mantine/hooks'; | ||
import { Paper, Text, Title, Button, useMantineTheme, rem } from '@mantine/core'; | ||
import classes from './RankBalls.module.css'; | ||
|
||
interface BallProps { | ||
colour: string; | ||
rank: number; | ||
} | ||
|
||
function Ball({ colour, rank }: BallProps) { | ||
return ( | ||
<Paper | ||
shadow='None' | ||
style={{ backgroundColor: '#87562A' }} | ||
> | ||
<div className={classes.ballContainer}> | ||
<div | ||
className={classes.ball} | ||
style={{ backgroundColor: colour }} | ||
> | ||
<Text className={classes.category} size="xs"> | ||
{rank} | ||
</Text> | ||
</div> | ||
<Button variant="white" color="dark"> | ||
View Leaderboard | ||
</Button> | ||
</div> | ||
</Paper> | ||
); | ||
} | ||
|
||
const data = [ | ||
{ | ||
colour: '#D9D9D9', | ||
rank: 0, | ||
}, | ||
{ | ||
colour:'#C5B460', | ||
rank: 1, | ||
}, | ||
{ | ||
colour:'#3E76B4', | ||
rank: 2, | ||
}, | ||
{ | ||
colour:'#658A66', | ||
rank: 3, | ||
}, | ||
{ | ||
colour:'#A65656', | ||
rank: 4, | ||
}, | ||
{ | ||
colour:'#222629', | ||
rank: 5, | ||
}, | ||
]; | ||
|
||
export function RankBalls() { | ||
const theme = useMantineTheme(); | ||
const mobile = useMediaQuery(`(max-width: ${theme.breakpoints.sm})`); | ||
const slides = data | ||
.filter((item): item is BallProps => item.colour !== undefined && item.rank !== undefined) | ||
.map((item) => ( | ||
<Carousel.Slide key={item.rank}> | ||
<Ball {...item} /> | ||
</Carousel.Slide> | ||
)); | ||
|
||
return ( | ||
<Carousel | ||
slideSize={{ base: '100%', sm: '6' }} | ||
slideGap={{ base: rem(2), sm: 'xl' }} | ||
align="start" | ||
slidesToScroll={mobile ? 1 : 2} | ||
style={classes.carousel} | ||
> | ||
{slides} | ||
</Carousel> | ||
); | ||
} |