Skip to content

Commit

Permalink
Merge pull request #329 from wingkwong/develop
Browse files Browse the repository at this point in the history
0.9.1 Release
  • Loading branch information
wingkwong authored Sep 26, 2024
2 parents 6960627 + 87ac84d commit d01b72b
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 123 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 0.9.1

- Bumped dependencies
- Fixed incorrect userAttempt count
- Fixed incorrect class names on multiple selection

## 0.9.0

- Added Progress Bar
Expand Down
4 changes: 2 additions & 2 deletions dist/index.es.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/bundle.js

Large diffs are not rendered by default.

153 changes: 74 additions & 79 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-quiz-component",
"version": "0.9.0",
"version": "0.9.1",
"description": "React Quiz Component",
"main": "dist/index.js",
"module": "dist/index.es.js",
Expand Down
20 changes: 2 additions & 18 deletions src/lib/Core.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,6 @@ function Core({
);
};

const isCorrectCheck = (index, correctAnswerIndex) => {
if (typeof correctAnswerIndex === 'string') {
return index === Number(correctAnswerIndex);
}

if (typeof correctAnswerIndex === 'object') {
return correctAnswerIndex.find((element) => element === index) !== undefined;
}

return false;
};

const renderQuizResultQuestions = useCallback(() => {
let filteredQuestions;
let filteredUserInput;
Expand Down Expand Up @@ -304,11 +292,7 @@ function Core({
<button
type="button"
disabled={answerButtons[index].disabled || false}
className={`${answerButtons[index].className || ''} answerBtn btn ${
isCorrectCheck(index + 1, correctAnswer) && showInstantFeedback
? 'correct'
: ''
}`}
className={`${answerButtons[index].className || ''} answerBtn btn`}
onClick={() => (revealAnswerOnSubmit ? onSelectAnswer(index) : onClickAnswer(index))}
>
{questionType === 'text' && <span>{answer}</span>}
Expand All @@ -319,7 +303,7 @@ function Core({
<button
type="button"
onClick={() => (revealAnswerOnSubmit ? onSelectAnswer(index) : onClickAnswer(index))}
className={`answerBtn btn ${(allowNavigation && checkSelectedAnswer(index + 1)) ? 'selected' : null}`}
className={`answerBtn btn ${(allowNavigation && checkSelectedAnswer(index + 1)) ? 'selected' : ''}`}
>
{questionType === 'text' && answer}
{questionType === 'photo' && <img src={answer} alt="answer" />}
Expand Down
Loading

0 comments on commit d01b72b

Please sign in to comment.