-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create wireframed quest details
- Loading branch information
1 parent
386385d
commit 65c9187
Showing
6 changed files
with
122 additions
and
3 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 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,85 @@ | ||
"use client"; | ||
|
||
import type { Quest } from "@/types/quest"; | ||
import { getQuestById } from "@/utils/api"; | ||
import { ExternalLinkIcon } from "@radix-ui/react-icons"; | ||
import Link from "next/link"; | ||
import type React from "react"; | ||
import { useEffect, useState } from "react"; | ||
|
||
const QuestDetails: React.FC = () => { | ||
const [quest, setQuest] = useState<Quest | null>(null); | ||
const [loading, setLoading] = useState<boolean>(true); | ||
const [error, setError] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
const fetchQuest = async () => { | ||
try { | ||
const data = await getQuestById(1); | ||
setQuest(data); | ||
setLoading(false); | ||
console.log(data); | ||
} catch (err) { | ||
setError("Failed to fetch quest"); | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
fetchQuest(); | ||
}, []); | ||
|
||
return ( | ||
<main className="flex flex-1 items-center justify-center bg-zinc-100"> | ||
<div className="flex flex-col flex-1"> | ||
<div className="flex flex-1 items-center mx-32 p-8 bg-red-300 rounded-lg mb-3"> | ||
<div className="w-16 h-16 bg-red-200" /> | ||
<h1 className="text-3xl flex-1 ml-5">{quest?.title}</h1> | ||
<div className="flex items-center"> | ||
<div className="w-4 h-4 bg-red-200" /> | ||
<span>+ 1234</span> | ||
</div> | ||
</div> | ||
<div className="flex flex-col flex-1 mx-32 justify-center bg-white p-8"> | ||
<div className="flex items-center"> | ||
<div className="w-16 h-16 bg-green-100" /> | ||
<div className="ml-7"> | ||
<h2 className="text-2xl font-medium mb-2">About this quest</h2> | ||
<p className="text-lg">{quest?.intro}</p> | ||
</div> | ||
</div> | ||
<div className="flex items-center my-6"> | ||
<div className="w-4 h-4 bg-zinc-300" /> | ||
<h2 className="ml-4 text-xl font-medium">Steps to earn</h2> | ||
</div> | ||
{quest?.steps.map((step) => { | ||
return ( | ||
<div | ||
className="flex flex-1 justify-between items-center mt-3" | ||
key={step.content} | ||
> | ||
<span className="flex items-center gap-1"> | ||
{step.content} | ||
<Link href="https://www.google.com.br"> | ||
<ExternalLinkIcon /> | ||
</Link> | ||
</span> | ||
<div className="flex items-center"> | ||
<span>{step.duration} minute read</span> | ||
<div className="w-4 h-4 bg-white border border-black ml-3" /> | ||
</div> | ||
</div> | ||
); | ||
})} | ||
<button | ||
type="button" | ||
className="bg-red-400 hover:bg-red-300 text-white font-bold p-4 rounded-lg self-end mt-8" | ||
> | ||
Complete quest | ||
</button> | ||
</div> | ||
</div> | ||
</main> | ||
); | ||
}; | ||
|
||
export default QuestDetails; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.