-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
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,36 @@ | ||
import { Achievement } from "../AuthProvider/AuthProvider"; | ||
|
||
interface AchievementBadgeProps { | ||
achievement: Achievement; | ||
achievedAchievements: string[]; | ||
} | ||
|
||
export default function AchievementBadge({ | ||
achievement, | ||
achievedAchievements, | ||
}: AchievementBadgeProps) { | ||
const isAchieved = achievedAchievements.includes(achievement.id); | ||
|
||
<div className="achievement-element relative m-4 hover:scale-105 transition-transform duration-200"> | ||
<div className="flex justify-between items-center px-2"> | ||
<p className="achievement-title text-center rounded-md py-1 px-2"> | ||
{achievement.achieved ? achievement.title : "?"} | ||
</p> | ||
</div> | ||
<img | ||
src={achievement.iconUrl || "default_achievement.png"} | ||
alt={achievement.title} | ||
className={`w-16 h-16 mx-auto my-2 ${ | ||
achievement.achieved ? "" : "grayscale" | ||
}`} | ||
/> | ||
<p className="achievement-description text-xs text-center bg-gray-800 py-1 px-2 rounded-md absolute -bottom-8 left-1/2 transform -translate-x-1/2"> | ||
{achievement.achieved | ||
? achievement.description | ||
: "Secret until achieved!"} | ||
</p> | ||
</div> | ||
); | ||
} | ||
|
||
export default AchievementBadge; |
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
89d37e4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for chessguessr ready!
✅ Preview
https://chessguessr-ko7uquwqf-assios.vercel.app
Built with commit 89d37e4.
This pull request is being automatically deployed with vercel-action