diff --git a/src/components/footer.js b/src/components/footer.js
index 4364b32..ed3dfa2 100644
--- a/src/components/footer.js
+++ b/src/components/footer.js
@@ -1,4 +1,3 @@
-import PropTypes from "prop-types"
import React from "react"
const Footer = () => (
@@ -10,7 +9,7 @@ const Footer = () => (
textAlign: `center`
}}
>
- © {new Date().getFullYear()}, Built with Love ♥
+ Built with Love ♥
)
diff --git a/src/components/progress-bar.js b/src/components/progress-bar.js
new file mode 100644
index 0000000..32acb13
--- /dev/null
+++ b/src/components/progress-bar.js
@@ -0,0 +1,35 @@
+import PropTypes from "prop-types"
+import React from "react"
+
+import { GetPercentage } from "../utils/style"
+import styles from "./progress-bar.module.css"
+
+const generateCircles = (count, key) => (
+ <>
+ {
+ [...Array(count).keys()].map(value =>
)
+ }
+ >
+)
+
+const ProgressBar = ({ current, total }) => {
+ const length = GetPercentage(current, total);
+ return (
+
+
{generateCircles(current, 'done')}
+
{generateCircles(total - current, 'left')}
+
+ )
+}
+
+ProgressBar.propTypes = {
+ current: PropTypes.number,
+ total: PropTypes.number
+}
+
+ProgressBar.defaultProps = {
+ current: 1,
+ total: 10
+}
+
+export default ProgressBar
diff --git a/src/components/progress-bar.module.css b/src/components/progress-bar.module.css
new file mode 100644
index 0000000..bdd0fc4
--- /dev/null
+++ b/src/components/progress-bar.module.css
@@ -0,0 +1,29 @@
+.barWrapper{
+ display: flex;
+ background: #ddd;
+ border-radius: 50px;
+}
+
+.bar{
+ height: 30px;
+ border-radius: 50px;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+}
+
+.activeBar{
+ background: #2b8a9d;
+ height: 30px;
+ border-radius: 50px;
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+}
+
+.quesTrack{
+ border-radius: 50%;
+ height: 10px;
+ width: 10px;
+ background: #fff;
+}
\ No newline at end of file
diff --git a/src/constants/config.js b/src/constants/config.js
index 92f510e..324d32f 100644
--- a/src/constants/config.js
+++ b/src/constants/config.js
@@ -1,7 +1,9 @@
const NUMBER_OF_QUESTIONS = 10
const TIME_FOR_EACH_QUESTION = 15
+const TIME_INTERVAL_BETWEEN_QUESTIONS = 1500
export default {
NUMBER_OF_QUESTIONS,
- TIME_FOR_EACH_QUESTION
+ TIME_FOR_EACH_QUESTION,
+ TIME_INTERVAL_BETWEEN_QUESTIONS
}
\ No newline at end of file
diff --git a/src/pages/index.js b/src/pages/index.js
index f5a3f4a..c0a93b8 100644
--- a/src/pages/index.js
+++ b/src/pages/index.js
@@ -2,11 +2,16 @@ import React, { Component } from "react"
import { CountdownCircleTimer } from "react-countdown-circle-timer";
import Layout from "../components/layout"
+import ProgressBar from "../components/progress-bar"
import SEO from "../components/seo"
-import styles from "../styles/index.module.css"
import Constants from "../constants/config"
-import data from "../jsons/transfer.json"
+import { GetQuizQuestionIndexes } from "../utils/style"
+import list from "../jsons/transfer.json"
import logo from "../jsons/team-logo.json"
+import styles from "../styles/index.module.css"
+
+const selectedIndex = GetQuizQuestionIndexes(Constants.NUMBER_OF_QUESTIONS, list.length)
+const data = selectedIndex.map(value => list[value])
const renderTime = value => {
if (value === 0) {
@@ -32,7 +37,7 @@ class Index extends Component {
Who am I?
@@ -47,13 +52,17 @@ class Index extends Component {
}
[false, 1000]}
+ onComplete={() => {
+ setTimeout(() => this.goToNextQuestion(), Constants.TIME_INTERVAL_BETWEEN_QUESTIONS)
+ return [false, Constants.TIME_INTERVAL_BETWEEN_QUESTIONS]
+ }}
+ key={this.state.currentQuestion}
/>
I am
@@ -91,8 +100,6 @@ class Index extends Component {
}
render() {
- console.log(Constants);
-
return this.renderPage();
}
}
diff --git a/src/styles/index.module.css b/src/styles/index.module.css
index 395fd44..c31ae1a 100644
--- a/src/styles/index.module.css
+++ b/src/styles/index.module.css
@@ -15,9 +15,8 @@
}
.progressWrapper{
- height: 100px;
border-bottom: 1px solid #ddd;
- padding: 10px 20px;
+ padding: 20px 40px;
}
.contentWrapper{
diff --git a/src/utils/style.js b/src/utils/style.js
new file mode 100644
index 0000000..2bd0a07
--- /dev/null
+++ b/src/utils/style.js
@@ -0,0 +1,6 @@
+export const GetPercentage = (current, total) => Math.ceil(((current / total) * 100));
+
+export const GetQuizQuestionIndexes = (length, total) => {
+ const array = [...Array(total).keys()]
+ return array.sort(() => { return .5 - Math.random() }).slice(0, length)
+}
\ No newline at end of file