feat: initial import — ClickerZ formation project (Express + React/Vite)
This commit is contained in:
37
Frontend/src/pages/Achievements.jsx
Executable file
37
Frontend/src/pages/Achievements.jsx
Executable file
@@ -0,0 +1,37 @@
|
||||
import { useState } from "react";
|
||||
import AchievementsCard from "../components/AchievementsCard";
|
||||
import "../scss/achievements.scss";
|
||||
import { useWildCoin } from "../components/WildCoin/WildCoinContext";
|
||||
import achievements from "../data/Achievements.json";
|
||||
|
||||
function Achievements() {
|
||||
const { wildCoin } = useWildCoin();
|
||||
let score = 1;
|
||||
if (wildCoin >= 25) {
|
||||
score = Math.floor((wildCoin - 25) / 400) + 1;
|
||||
} else {
|
||||
score = 0;
|
||||
}
|
||||
return (
|
||||
<div className="fullachieve">
|
||||
<h1>Succès</h1>
|
||||
<div className="achievementscontainer">
|
||||
<div className="achievementscardcontainer">
|
||||
{achievements &&
|
||||
achievements.slice(0, score).map((a) => {
|
||||
return (
|
||||
<AchievementsCard
|
||||
key={a.id}
|
||||
name={a.name}
|
||||
description={a.description}
|
||||
image={a.image}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Achievements;
|
||||
Reference in New Issue
Block a user