-
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.
Using separated pages insteads of components
- Loading branch information
1 parent
f4645f2
commit 8c8467f
Showing
8 changed files
with
69 additions
and
177 deletions.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,48 @@ | ||
import { NextPage } from "next"; | ||
import React, { useContext, useEffect, useState } from "react"; | ||
import { useRouter } from "next/router"; | ||
import { QuestsContext } from "../../context/QuestsProvider"; | ||
import styles from "../../styles/category.module.css"; | ||
import homeStyles from "../../styles/Home.module.css"; | ||
import Quest from "../../components/quests/quest"; | ||
import BackButton from "../../components/UI/backButton"; | ||
|
||
const CategoriesPage: NextPage = () => { | ||
const router = useRouter(); | ||
const { category: categoryName } = router.query; | ||
const { categories } = useContext(QuestsContext); | ||
|
||
const [category, setCategory] = useState<QuestCategory | undefined>(); | ||
|
||
useEffect(() => { | ||
if (!categoryName) return; | ||
setCategory(categories.find((cat) => cat.name === categoryName)); | ||
}, [categories, categoryName]); | ||
|
||
return ( | ||
<div className={homeStyles.screen}> | ||
<div className={homeStyles.backButton}> | ||
<BackButton onClick={() => router.back()} /> | ||
</div> | ||
<h1 className={homeStyles.title}>Onboarding quests</h1> | ||
<div className={styles.questList}> | ||
{category && | ||
category.quests.map((quest, index) => ( | ||
<Quest | ||
key={index} | ||
title={quest.title_card} | ||
onClick={() => router.push(`/quest/${quest.id}`)} | ||
imgSrc={quest.img_card} | ||
issuer={{ | ||
name: quest.issuer, | ||
logoFavicon: quest.logo, | ||
}} | ||
reward={quest.rewards_title} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CategoriesPage; |
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,15 @@ | ||
.questList { | ||
display: flex; | ||
gap: 1rem; | ||
margin-top: 2rem; | ||
flex-wrap: wrap; | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.blur { | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
z-index: -1; | ||
} |