Skip to content

Commit

Permalink
Merge pull request #100 from HabibMollah/extracting-state-logic-into-…
Browse files Browse the repository at this point in the history
…a-reducer

Extracting state logic into a reducer (100% finished)
  • Loading branch information
moshfiqrony authored Aug 12, 2024
2 parents a922975 + 86fa226 commit 9f7c73c
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 126 deletions.
18 changes: 8 additions & 10 deletions src/components/MDX/Challenges/Challenge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function Challenge({
className="text-xl text-primary dark:text-primary-dark mb-2 mt-0 font-medium"
id={currentChallenge.id}>
<div className="font-bold block md:inline">
{isRecipes ? 'Example' : 'Challenge'} {currentChallenge.order} of{' '}
{isRecipes ? 'উদাহরণ' : 'চ্যালেঞ্জ'} {currentChallenge.order} /{' '}
{totalChallenges}
<span className="text-primary dark:text-primary-dark">: </span>
</div>
Expand All @@ -63,14 +63,14 @@ export function Challenge({
<div>
<Button className="me-2" onClick={toggleHint} active={showHint}>
<IconHint className="me-1.5" />{' '}
{showHint ? 'Hide hint' : 'Show hint'}
{showHint ? 'হিন্ট লুকান' : 'হিন্ট দেখুন'}
</Button>
<Button
className="me-2"
onClick={toggleSolution}
active={showSolution}>
<IconSolution className="me-1.5" />{' '}
{showSolution ? 'Hide solution' : 'Show solution'}
{showSolution ? 'সমাধান লুকান' : 'সমাধান দেখুন'}
</Button>
</div>
) : (
Expand All @@ -80,7 +80,7 @@ export function Challenge({
onClick={toggleSolution}
active={showSolution}>
<IconSolution className="me-1.5" />{' '}
{showSolution ? 'Hide solution' : 'Show solution'}
{showSolution ? 'সমাধান লুকান' : 'সমাধান দেখুন'}
</Button>
)
)}
Expand All @@ -94,7 +94,7 @@ export function Challenge({
)}
onClick={handleClickNextChallenge}
active>
Next {isRecipes ? 'Example' : 'Challenge'}
পরবর্তী {isRecipes ? 'উদাহরণ' : 'চ্যালেঞ্জ'}
<IconArrowSmall displayDirection="end" className="block ms-1.5" />
</Button>
)}
Expand All @@ -104,21 +104,19 @@ export function Challenge({
{showSolution && (
<div className="mt-6">
<h3 className="text-2xl font-bold text-primary dark:text-primary-dark">
Solution
সমাধান
</h3>
{currentChallenge.solution}
<div className="flex justify-between items-center mt-4">
<Button onClick={() => setShowSolution(false)}>
Close solution
</Button>
<Button onClick={() => setShowSolution(false)}>সমাধান লুকান</Button>
{hasNextChallenge && (
<Button
className={cn(
isRecipes ? 'bg-purple-50' : 'bg-link dark:bg-link-dark'
)}
onClick={handleClickNextChallenge}
active>
Next Challenge
পরবর্তী চ্যালেঞ্জ
<IconArrowSmall
displayDirection="end"
className="block ms-1.5"
Expand Down
4 changes: 3 additions & 1 deletion src/components/MDX/Challenges/Challenges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export function Challenges({
children,
isRecipes,
noTitle,
titleText = isRecipes ? 'Try out some examples' : 'Try out some challenges',
titleText = isRecipes
? 'কিছু উদাহরণ চর্চা করুন'
: 'কিছু চ্যালেঞ্জ চর্চা করুন',
titleId = isRecipes ? 'examples' : 'challenges',
}: ChallengesProps) {
const challenges = parseChallengeContents(children);
Expand Down
Loading

0 comments on commit 9f7c73c

Please sign in to comment.