Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Q
Quizes
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hemanshc
Quizes
Commits
5d47f797
Commit
5d47f797
authored
May 07, 2022
by
Choudhary
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial changes for quiz exam
parent
c4a9ccea
Pipeline
#2279
failed with stages
in 87 minutes and 37 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
194 additions
and
13 deletions
+194
-13
App.js
src/App.js
+30
-13
Section.jsx
src/Components/Section.jsx
+34
-0
mock.js
src/MockData/mock.js
+130
-0
No files found.
src/App.js
View file @
5d47f797
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
,
useState
}
from
'react'
;
import
'./App.css'
;
class
App
extends
Component
{
render
()
{
return
(
<
div
className
=
"App"
>
<
header
className
=
"App-header"
>
<
p
>
Welcome
to
Playground
!
<
/p
>
<
/header
>
<
/div
>
);
}
export
const
Section
=
({
type
})
=>
{
const
[
startJS
,
setStartJS
]
=
useState
(
false
);
const
[
startReact
,
setStartReact
]
=
useState
(
false
);
const
[
startTest
,
setStartTest
]
=
useState
(
false
);
return
(
<
div
className
=
"App"
>
<
header
className
=
"App-header"
>
<
p
>
Welcome
to
Playground
!
<
/p
>
<
/header
>
<
body
>
<
div
>
<
div
onClick
=
{()
=>
{
setStartJS
(
true
),
setStartReact
(
false
),
setStartTest
(
false
)}}
>
<
h3
>
JS
Quiz
<
/h3
>
{
startJS
&&
<
Section
type
=
"javascript"
/>
}
<
/div
>
<
div
onClick
=
{()
=>
{
setStartJS
(
false
),
setStartReact
(
true
),
setStartTest
(
false
)}}
>
<
h3
>
React
Quiz
<
/h3
>
{
startReact
&&
<
Section
type
=
"react"
/>
}
<
/div
>
<
div
onClick
=
{()
=>
{
setStartJS
(
false
),
setStartReact
(
false
),
setStartTest
(
true
)}}
>
<
h3
>
Test
Quiz
<
/h3
>
{
startTest
&&
<
Section
type
=
"test"
/>
}
<
/div
>
<
/div
>
<
/body
>
<
/div
>
);
}
export
default
App
;
src/Components/Section.jsx
0 → 100644
View file @
5d47f797
import
react
from
'react'
;
import
{
mockdata
}
from
'../MockData/mock'
export
const
Section
=
({
type
})
=>
{
return
(<>
{
type
===
'javascript'
?
<
div
>
{
mockdata
.
javascriptQuiz
.
map
((
questions
)
=>
(<
div
>
{
Object
.
keys
(
questions
).
map
(
question
=>
(<><
p
>
{
questions
.
question
}
</
p
>
{
Object
.
keys
(
questions
[
question
]).
map
((
opt
)
=>
(<
div
className=
"flex"
>
<
input
type=
"checkbox"
value=
{
questions
.
question
.
opt
}
/>
<
p
>
{
opt
}
</
p
>
</
div
>))
}
</>))
}
</
div
>))
}
</
div
>
:
type
===
'react'
?
<
div
>
{
mockdata
.
reactQuiz
.
map
((
questions
)
=>
(<
div
>
{
Object
.
keys
(
questions
).
map
(
question
=>
(<><
p
>
{
questions
.
question
}
</
p
>
{
Object
.
keys
(
questions
[
question
]).
map
((
opt
)
=>
(<
div
className=
"flex"
>
<
input
type=
"checkbox"
value=
{
questions
.
question
.
opt
}
/>
<
p
>
{
opt
}
</
p
>
</
div
>))
}
</>))
}
</
div
>))
}
</
div
>
:
type
===
'test'
?
<
div
>
{
mockdata
.
testQuiz
.
map
((
questions
)
=>
(<
div
>
{
Object
.
keys
(
questions
).
map
(
question
=>
(<><
p
>
{
questions
.
question
}
</
p
>
{
Object
.
keys
(
questions
[
question
]).
map
((
opt
)
=>
(<
div
className=
"flex"
>
<
input
type=
"checkbox"
value=
{
questions
.
question
[
opt
]
}
/>
<
p
>
{
opt
}
</
p
>
</
div
>))
}
</>))
}
</
div
>))
}
</
div
>
:
null
}
</>)
}
\ No newline at end of file
src/MockData/mock.js
0 → 100644
View file @
5d47f797
export
const
mockdata
=
{
"javascriptQuiz"
:
[
{
"question1"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question2"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question3"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question4"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question5"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
}
],
"reactQuiz"
:
[
{
"question1"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question2"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question3"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question4"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question5"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
}
],
"testQuiz"
:
[
{
"question1"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question2"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question3"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question4"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
},
{
"question5"
:
{
"option1"
:
true
,
"option2"
:
true
,
"option3"
:
true
,
"option4"
:
false
}
}
]
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment