Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added progress bar for the quiz #282

Merged
merged 6 commits into from
Jul 7, 2024
Merged

Conversation

Jaykovsky
Copy link
Contributor

Hi,

I made some some changes and i fixed the ProgressBar component.
Now it displays the progress correctly.

The new component is called ProgressBar.jsx, it received two opcional props: progressBarColor and height.
You can enable or disable with the prop: enableProgressBar (Its receive a boolean value) at the Quiz component; and you can change the color of the progress bar with the prop: progressBarColor (It receive a string value).

First question:
2024-07-02_16-04

Second question:
2024-07-02_16-04_1

Third question:
2024-07-02_16-04_2

Four question:
2024-07-02_16-04_3

End quiz:
2024-07-02_16-05

Copy link
Owner

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also include your new changes in props in README.md

https://github.com/wingkwong/react-quiz-component?tab=readme-ov-file#props

src/lib/Quiz.jsx Outdated Show resolved Hide resolved
@Jaykovsky
Copy link
Contributor Author

please also include your new changes in props in README.md

https://github.com/wingkwong/react-quiz-component?tab=readme-ov-file#props

It's done.

Copy link
Owner

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow I think it's a bit redundant to have two props in order to show the progress bar. We can do something as follows:

  • enable the progress bar only enableProgressBar is true (which you've already done that)
  • set a default progressBarColor. However, users can override the color by specifying in quiz object. e.g.
const quiz = {
  quizTitle: 'React Quiz Component Demo',
  quizSynopsis: 'Lorem ipsum dolor',
  nrOfQuestions: '6',
  questions: [{...}],
  progressBarColor: '#FF0000'
};
<Quiz
  quiz={quiz}
  enableProgressBar
/>

@Jaykovsky
Copy link
Contributor Author

I got you bro.

The changes are already made. U can check and review.

Copy link
Owner

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be final round of changes

src/lib/Quiz.jsx Outdated
Comment on lines 122 to 130
if (quiz.progressBarColor && typeof quiz.progressBarColor !== 'string') {
console.error('progressBarColor must be a String');
return false;
}

if ('progressBarColor' in quiz && !validateProgressBarColor(quiz.progressBarColor)) {
console.error('progressBarColor must be a valid hex colour');
return false;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ('progressBarColor' in quiz) {
  if (typeof quiz.progressBarColor !== 'string') {
      console.error('progressBarColor must be a String');
      return false;
  }
  if (!validateProgressBarColor(quiz.progressBarColor)) {
      console.error('progressBarColor must be a valid hex colour');
      return false;
  }
}

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/docs/quiz.jsx Outdated Show resolved Hide resolved
src/lib/core-components/ProgressBar.jsx Outdated Show resolved Hide resolved
src/lib/core-components/ProgressBar.jsx Outdated Show resolved Hide resolved
@Jaykovsky
Copy link
Contributor Author

@wingkwong All requested changes have been applied.

Copy link
Owner

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please test it once before requesting review.

src/lib/Quiz.jsx Outdated Show resolved Hide resolved
@Jaykovsky
Copy link
Contributor Author

@wingkwong Sorry, i forget to test before push.

Now the error is gone, i tested. U can check.

@wingkwong wingkwong merged commit 33c3a3e into wingkwong:develop Jul 7, 2024
wingkwong added a commit that referenced this pull request Sep 25, 2024
* chore(deps): update dependency rollup to v4.18.0

* chore(deps): update dependency @rollup/plugin-commonjs to v25.0.8

* chore(deps): update babel monorepo to v7.24.6

* chore(deps): update dependency eslint-plugin-react to v7.34.2

* fix(deps): update dependency dompurify to v3.1.5

* chore(deps): update dependency css-loader to v7.1.2

* chore(deps): update babel monorepo to v7.24.7

* chore(deps): update dependency @rollup/plugin-replace to v5.0.7

* chore(deps): update dependency @rollup/plugin-commonjs to v26

* chore(deps): update dependency eslint-plugin-react to v7.34.3

* chore(deps): update dependency webpack to v5.92.1

* chore(deps): update dependency eslint-plugin-jsx-a11y to v6.9.0

* fix(deps): update dependency dompurify to v3.1.6

* feat: progress bar (#282)

* --added fixed progress bar

* --added props for readme and validation for progress bar input color

* --progressBarColor in quiz object

* --added some changes

* --minor error fixed

---------

Co-authored-by: աӄա <[email protected]>

* chore(deps): update dependency rollup to v4.18.1 (#288)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @babel/preset-env to v7.24.8 (#289)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency rollup to v4.19.0 (#292)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency eslint-plugin-react to v7.35.0 (#291)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency webpack to v5.93.0 (#290)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps-dev): bump follow-redirects from 1.15.5 to 1.15.6 (#287)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump express from 4.18.2 to 4.19.2 (#286)

Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.18.2...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump ws from 8.16.0 to 8.18.0 (#285)

Bumps [ws](https://github.com/websockets/ws) from 8.16.0 to 8.18.0.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](websockets/ws@8.16.0...8.18.0)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump braces from 3.0.2 to 3.0.3 (#284)

Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](micromatch/braces@3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): update dependency @babel/preset-env to v7.25.4 (#293)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency mini-css-extract-plugin to v2.9.1 (#296)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency rollup to v4.21.2 (#294)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency eslint-plugin-react to v7.35.1 (#299)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency eslint-plugin-import to v2.30.0 (#300)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency eslint-plugin-react to v7.35.2 (#301)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency webpack-dev-server to v5.1.0 (#302)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency eslint-plugin-jsx-a11y to v6.10.0 (#303)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps-dev): bump webpack from 5.93.0 to 5.94.0 (#304)

Bumps [webpack](https://github.com/webpack/webpack) from 5.93.0 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.93.0...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): update dependency webpack to v5.94.0 [security] (#298)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency rollup to v4.22.0 (#305)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency rollup to v4.22.4 (#310)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @rollup/plugin-node-resolve to v15.3.0 (#312)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(lib): undefined className (#318)

* chore(lib): lint

* chore(deps): update dependency @rollup/plugin-replace to v6 (#316)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency eslint-plugin-react to v7.36.1 (#306)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency babel-loader to v9.2.1 (#307)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency eslint to v8.57.1 (#308)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @rollup/plugin-html to v1.0.4 (#311)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency @rollup/plugin-commonjs to v28 (#315)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Expose time taken in result object (#295)

* --added fixed progress bar

* --added props for readme and validation for progress bar input color

* --progressBarColor in quiz object

* --added some changes

* --minor error fixed

* added time spent at QuestionSummary

---------

Co-authored-by: WK Wong <[email protected]>

* 0.9.0 Release

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jay <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Title: Enhancement Request: Show Quiz Progress During Quiz in React-Quiz Library
2 participants