-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: karnot quest visuals * banner * adding banner
- Loading branch information
1 parent
0716060
commit 0ee606b
Showing
7 changed files
with
113 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,42 @@ | ||
import { FunctionComponent, useMemo } from "react"; | ||
import questBanners from "../../public/utils/questbanners.json"; | ||
import styles from "@styles/quests.module.css"; | ||
import Button from "@components/UI/button"; | ||
|
||
type QuestBannerProps = { | ||
questId: string; | ||
}; | ||
|
||
const QuestBanner: FunctionComponent<QuestBannerProps> = ({ questId }) => { | ||
const bannerDetails = useMemo(() => { | ||
return questBanners.find((banner) => banner.questId === questId); | ||
}, [questId]); | ||
return bannerDetails ? ( | ||
<div className={styles.questBanner}> | ||
<div | ||
className={styles.questBannerImage} | ||
style={{ backgroundImage: `url(${bannerDetails.image})` }} | ||
/> | ||
<div className={styles.questBannerContent}> | ||
<h2 className={styles.questBannerTitle}> | ||
{bannerDetails.tag ? ( | ||
<span className={styles.bannerTag}>{bannerDetails.tag} - </span> | ||
) : null} | ||
{bannerDetails.title} | ||
</h2> | ||
<p>{bannerDetails.description}</p> | ||
<div className="w-fit"> | ||
<Button | ||
onClick={() => { | ||
window.open(bannerDetails.href, "_blank"); | ||
}} | ||
> | ||
{bannerDetails.cta} | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
) : null; | ||
}; | ||
|
||
export default QuestBanner; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,11 @@ | ||
[ | ||
{ | ||
"questId": "224", | ||
"tag": "Optional", | ||
"title": "Write a thread on xSTRK", | ||
"description": "Top 10 threads get $50 each.", | ||
"cta": "Participate", | ||
"href": "https://www.typeform.com/", | ||
"image": "/karnot/endurBanner.webp" | ||
} | ||
] |
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