Skip to content

Commit 4375dd2

Browse files
authored
Merge pull request #143 from wingkwong/develop
0.6.0 Release
2 parents f78fb53 + 047e838 commit 4375dd2

17 files changed

+6046
-23101
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# CHANGELOG
22

3+
## 0.6.0
4+
5+
- Display marks in questions (marksOfQuestion)
6+
- Bump dependencies
7+
- Add renovate
8+
- Add ShuffleAnswer
9+
- Add total count of questions
10+
- Responsive Design
11+
- Revise demo site
12+
- Fix Scrolling
13+
314
## 0.5.1
415

516
- Replace `marked` by `snarkdown`

README.md

Lines changed: 71 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ react-quiz-component is a ReactJS component allowing users to attempt a quiz.
2323
- Allow markdown in Question
2424
- Allow Picture in Question
2525
- Scoring System
26+
- Shuffling Questions / Answers
2627

2728
## Installing
2829

@@ -32,13 +33,14 @@ npm i react-quiz-component
3233

3334
## Importing react-quiz-component
3435

35-
```
36+
```js
3637
import Quiz from 'react-quiz-component';
3738
```
3839

3940
## Defining Your Quiz Source
4041
The quiz source is a JSON object. You can use [react-quiz-form](https://github.com/wingkwong/react-quiz-form/) to generate it.
41-
```javascript
42+
43+
```js
4244
export const quiz = {
4345
"quizTitle": "React Quiz Component Demo",
4446
"quizSynopsis": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim",
@@ -143,73 +145,83 @@ export const quiz = {
143145
### Locale Customization
144146

145147
If you want to use your customized text, you can add appLocale into your quiz source. Below is the default one. <questionLength> and <correctIndexLength> will be replaced dynamically.
146-
```javascript
147-
"appLocale": {
148-
"landingHeaderText": "<questionLength> Questions",
149-
"question": "Question",
150-
"startQuizBtn": "Start Quiz",
151-
"resultFilterAll": "All",
152-
"resultFilterCorrect": "Correct",
153-
"resultFilterIncorrect": "Incorrect",
154-
"prevQuestionBtn": "Prev",
155-
"nextQuestionBtn": "Next",
156-
"resultPageHeaderText": "You have completed the quiz. You got <correctIndexLength> out of <questionLength> questions."
157-
}
148+
149+
```json
150+
"appLocale": {
151+
"landingHeaderText": "<questionLength> Questions",
152+
"question": "Question",
153+
"startQuizBtn": "Start Quiz",
154+
"resultFilterAll": "All",
155+
"resultFilterCorrect": "Correct",
156+
"resultFilterIncorrect": "Incorrect",
157+
"prevQuestionBtn": "Prev",
158+
"nextQuestionBtn": "Next",
159+
"resultPageHeaderText": "You have completed the quiz. You got <correctIndexLength> out of <questionLength> questions."
160+
}
158161
```
159162

160163
## Passing to Quiz container
161164

162-
```javascript
163-
import { quiz } from './quiz';
164-
...
165-
<Quiz quiz={quiz}/>
165+
```js
166+
import { quiz } from './quiz';
167+
...
168+
<Quiz quiz={quiz}/>
169+
```
170+
171+
## Shuffling Question Set
172+
173+
```js
174+
import { quiz } from './quiz';
175+
...
176+
<Quiz quiz={quiz} shuffle={true}/>
166177
```
167178

168-
## Shuffling question set
179+
## Shuffling Answer Set
169180

170-
```javascript
171-
import { quiz } from './quiz';
172-
...
173-
<Quiz quiz={quiz} shuffle={true}/>
181+
```js
182+
import { quiz } from './quiz';
183+
...
184+
<Quiz quiz={quiz} shuffleAnswer={true}/>
174185
```
175186

176187
## Disabling Default Result Page
177188

178-
```javascript
179-
import { quiz } from './quiz';
180-
...
181-
<Quiz quiz={quiz} showDefaultResult={false}/>
189+
```js
190+
import { quiz } from './quiz';
191+
...
192+
<Quiz quiz={quiz} showDefaultResult={false}/>
182193
```
183194

184195
## Enabling Custom Result Page
185196

186197
* In order to enable custom result page, showDefaultResult has to be false.
187-
```javascript
188-
import { quiz } from './quiz';
189-
...
190-
const renderCustomResultPage = (obj) => {
191-
console.log(obj);
192-
return (
193-
<div>
194-
This is a custom result page. You can use obj to render your custom result page
195-
</div>
196-
)
197-
}
198-
...
199-
<Quiz quiz={quiz} showDefaultResult={false} customResultPage={renderCustomResultPage}/>
198+
```js
199+
import { quiz } from './quiz';
200+
...
201+
const renderCustomResultPage = (obj) => {
202+
console.log(obj);
203+
return (
204+
<div>
205+
This is a custom result page. You can use obj to render your custom result page
206+
</div>
207+
)
208+
}
209+
210+
```
211+
<Quiz quiz={quiz} showDefaultResult={false} customResultPage={renderCustomResultPage}/>
200212
```
201213
202214
## Enabling onComplete Action
203215
204-
```javascript
205-
import { quiz } from './quiz';
206-
...
207-
const setQuizResult = (obj) => {
208-
console.log(obj);
209-
// YOUR LOGIC GOES HERE
210-
}
211-
...
212-
<Quiz quiz={quiz} showDefaultResult={false} onComplete={setQuizResult}/>
216+
```js
217+
import { quiz } from './quiz';
218+
...
219+
const setQuizResult = (obj) => {
220+
console.log(obj);
221+
// YOUR LOGIC GOES HERE
222+
}
223+
...
224+
<Quiz quiz={quiz} showDefaultResult={false} onComplete={setQuizResult}/>
213225
```
214226

215227
## Example of Quiz Summary returned to customResultPage and onComplete
@@ -228,23 +240,22 @@ Object
228240
userInput: (5) [1, 2, 1, 2, 3]
229241
totalPoints: 100
230242
correctPoints: 40
231-
232243
````
233244

234245
## Showing Instant Feedback
235246

236-
```javascript
237-
import { quiz } from './quiz';
238-
...
239-
<Quiz quiz={quiz} showInstantFeedback={true}/>
247+
```js
248+
import { quiz } from './quiz';
249+
...
250+
<Quiz quiz={quiz} showInstantFeedback={true}/>
240251
```
241252

242253
## Answering the same question till it is correct
243254

244-
```javascript
245-
import { quiz } from './quiz';
246-
...
247-
<Quiz quiz={quiz} continueTillCorrect={true}/>
255+
```js
256+
import { quiz } from './quiz';
257+
...
258+
<Quiz quiz={quiz} continueTillCorrect={true}/>
248259
```
249260

250261
## Props
@@ -253,6 +264,7 @@ Object
253264
|:--|:--:|:-----:|:--|:----------|
254265
|quiz|`object`|`null`|Y|Quiz Json Object|
255266
|shuffle|`boolean`|`false`|N|Shuffle the questions|
267+
|shuffleAnswer|`boolean`|`false`|N|Shuffle the answers|
256268
|showDefaultResult|`boolean`|`true`|N|Show the default result page|
257269
|customResultPage|`function`|`null`|N|A quiz summary object will be returned to the function and users can use it to render its custom result page|
258270
|onComplete|`function`|`null`|N|A quiz summary object will be returned to the function|
@@ -275,4 +287,4 @@ The demo is available at https://wingkwong.github.io/react-quiz-component/
275287

276288
## License
277289

278-
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
290+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

docs/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/favicon.ico

15.1 KB
Binary file not shown.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta name="description" content="React Quiz Component Demo"><title>React Quiz Component Demo</title><script defer="defer" src="bundle.js"></script></head><body><div id="app"></div></body></html>
1+
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta name="description" content="React Quiz Component Demo"><title>React Quiz Component Demo</title><script defer="defer" src="bundle.js"></script><link href="main.css" rel="stylesheet"></head><body><div id="app"></div></body></html>

0 commit comments

Comments
 (0)