-
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.
Merge pull request #21 from brolag/refactor/files-structure
ref: Refactor Statement component and adjust challenge 4
- Loading branch information
Showing
7 changed files
with
102 additions
and
25 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
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 |
---|---|---|
@@ -1,19 +1,29 @@ | ||
const Statement = () => { | ||
return ( | ||
<div className="w-full max-w-[64rem] p-4 bg-gray-700 rounded-lg mb-6 font-play shadow-lg"> | ||
<div className="mb-4"> | ||
<h3 className="text-white text-xl font-bold">Statements</h3> | ||
<ul className="text-gray-300"> | ||
<li>- Knights always tell the truth.</li> | ||
<li>- Knaves always lie.</li> | ||
</ul> | ||
</div> | ||
<div className="mb-4"> | ||
<p className="text-gray-300">Character A: B is a knave.</p> | ||
<p className="text-gray-300">Character B: A and I are of opposite types.</p> | ||
</div> | ||
</div> | ||
); | ||
import React from "react"; | ||
// Import the statement for every challenge | ||
import Challenge2Content from "../public/challenges/challenge_2/statement"; | ||
import Challenge4Content from "../public/challenges/challenge_4/statement"; | ||
|
||
type StatementProps = { | ||
challengeId: string; | ||
}; | ||
|
||
const NotFoundContent = () => <p>Challenge not found</p>; | ||
|
||
const Statement = ({ challengeId }: StatementProps) => { | ||
let ChallengeContent; | ||
|
||
switch (challengeId) { | ||
case "2": | ||
ChallengeContent = Challenge2Content; | ||
break; | ||
case "4": | ||
ChallengeContent = Challenge4Content; | ||
break; | ||
default: | ||
ChallengeContent = NotFoundContent; | ||
} | ||
|
||
return <ChallengeContent />; | ||
}; | ||
|
||
export default Statement; |
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
17 changes: 17 additions & 0 deletions
17
packages/nextjs/public/challenges/challenge_2/statement.js
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,17 @@ | ||
const Challenge2Content = () => ( | ||
<div className="w-full max-w-[64rem] p-4 bg-gray-700 rounded-lg mb-6 font-play shadow-lg"> | ||
<div className="mb-4"> | ||
<h3 className="text-white text-xl font-bold">Statements</h3> | ||
<ul className="text-gray-300"> | ||
<li>- Knights always tell the truth.</li> | ||
<li>- Knaves always lie.</li> | ||
</ul> | ||
</div> | ||
<div className="mb-4"> | ||
<p className="text-gray-300">Character A: B is a knave.</p> | ||
<p className="text-gray-300">Character B: A and I are of opposite types.</p> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default Challenge2Content; |
17 changes: 17 additions & 0 deletions
17
packages/nextjs/public/challenges/challenge_4/statement.js
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,17 @@ | ||
const Challenge4Content = () => ( | ||
<div className="w-full max-w-[64rem] p-4 bg-gray-700 rounded-lg mb-6 font-play shadow-lg"> | ||
<div className="mb-4"> | ||
<h3 className="text-white text-xl font-bold">Statements</h3> | ||
<ul className="text-gray-300"> | ||
<li>- Knights always tell the truth.</li> | ||
<li>- Knaves always lie.</li> | ||
</ul> | ||
</div> | ||
<div className="mb-4"> | ||
<p className="text-gray-300">Character A: B is a knave.</p> | ||
<p className="text-gray-300">Character B: A and I are of opposite types.</p> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default Challenge4Content; |
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