{"size": 1103, "ext": "js", "max_stars_repo_path": "eduroom_frontend/components/leaderboard/rank.js", "max_stars_repo_name": "GGolfz/Eduroom", "max_stars_repo_stars_event_min_datetime": "2021-01-20T15:23:38.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-12T13:55:54.000Z", "max_issues_repo_path": "eduroom_frontend/components/leaderboard/rank.js", "max_issues_repo_name": "GGolfz/Eduroom", "max_issues_repo_issues_event_min_datetime": "2021-07-04T14:47:58.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-04T14:47:58.000Z", "max_forks_repo_path": "eduroom_frontend/components/leaderboard/rank.js", "max_forks_repo_name": "GGolfz/Eduroom", "max_forks_repo_forks_event_min_datetime": "2021-01-25T09:46:20.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-22T06:48:38.000Z"}
{"max_stars_count": 6, "max_issues_count": 1, "max_forks_count": 4, "avg_line_length": 20.8113207547, "max_line_length": 78, "alphanum_fraction": 0.4986400725}
import { Fragment } from 'react'
const Rank = ({ data, mini }) => {
	const specialRank = () => {
		if (data.rank == 1) {
			return 'gold'
		} else if (data.rank == 2) {
			return 'silver'
		} else if (data.rank == 3) {
			return 'bronze'
		} else {
			return data.rank % 2 == 0 ? 'odd' : 'even'
		}
	}
	return (
		<Fragment>
			<div className={'rank ' + specialRank()}>
				<div style={{ width: `${mini ? '30%' : '10%'}` }}>{data.rank}</div>
				<div style={{ width: `${mini ? '70%' : '30%'}` }}>{data.displayname}</div>
				{mini ? null : (
					<Fragment>
						<div>{data.titlename}</div>
						<div>{data.xp}</div>
					</Fragment>
				)}
			</div>
			<style jsx>
				{`
					.rank {
						border-radius: 10px;
						display: flex;
						height: 40px;
						margin: 0.5rem;
						color: #828282;
						padding: 0rem 1rem;
						align-items: center;
						font-weight: bold;
					}
					.rank.gold {
						background: #ffc745;
					}
					.rank.silver {
						background: #e9e9e9;
					}
					.rank.bronze {
						background: #ffac86;
					}
				`}
			</style>
		</Fragment>
	)
}
export default Rank
