Skip to content

Commit 7b58d2f

Browse files
committed
this is version-0.1
0 parents  commit 7b58d2f

17 files changed

+10692
-0
lines changed

Diff for: .gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

Diff for: README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `npm start`
8+
9+
Runs the app in the development mode.<br>
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.<br>
13+
You will also see any lint errors in the console.
14+
15+
### `npm test`
16+
17+
Launches the test runner in the interactive watch mode.<br>
18+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
20+
### `npm run build`
21+
22+
Builds the app for production to the `build` folder.<br>
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
The build is minified and the filenames include the hashes.<br>
26+
Your app is ready to be deployed!
27+
28+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29+
30+
### `npm run eject`
31+
32+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33+
34+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35+
36+
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37+
38+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39+
40+
## Learn More
41+
42+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43+
44+
To learn React, check out the [React documentation](https://reactjs.org/).
45+
46+
### Code Splitting
47+
48+
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49+
50+
### Analyzing the Bundle Size
51+
52+
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53+
54+
### Making a Progressive Web App
55+
56+
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57+
58+
### Advanced Configuration
59+
60+
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61+
62+
### Deployment
63+
64+
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65+
66+
### `npm run build` fails to minify
67+
68+
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

Diff for: package.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "exam",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"react": "^16.8.5",
7+
"react-dom": "^16.8.5",
8+
"react-scripts": "2.1.8"
9+
},
10+
"scripts": {
11+
"start": "react-scripts start",
12+
"build": "react-scripts build",
13+
"test": "react-scripts test",
14+
"eject": "react-scripts eject"
15+
},
16+
"eslintConfig": {
17+
"extends": "react-app"
18+
},
19+
"browserslist": [
20+
">0.2%",
21+
"not dead",
22+
"not ie <= 11",
23+
"not op_mini all"
24+
]
25+
}

Diff for: public/favicon.ico

3.78 KB
Binary file not shown.

Diff for: public/index.html

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta
7+
name="viewport"
8+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
9+
/>
10+
<meta name="theme-color" content="#000000" />
11+
<!--
12+
manifest.json provides metadata used when your web app is installed on a
13+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
14+
-->
15+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
16+
<!--
17+
Notice the use of %PUBLIC_URL% in the tags above.
18+
It will be replaced with the URL of the `public` folder during the build.
19+
Only files inside the `public` folder can be referenced from the HTML.
20+
21+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
22+
work correctly both with client-side routing and a non-root public URL.
23+
Learn how to configure a non-root public URL by running `npm run build`.
24+
--><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
25+
<title>React App</title>
26+
</head>
27+
<body>
28+
<noscript>You need to enable JavaScript to run this app.</noscript>
29+
<div id="root"></div>
30+
<!--
31+
This HTML file is a template.
32+
If you open it directly in the browser, you will see an empty page.
33+
34+
You can add webfonts, meta tags, or analytics to this file.
35+
The build step will place the bundled scripts into the <body> tag.
36+
37+
To begin the development, run `npm start` or `yarn start`.
38+
To create a production bundle, use `npm run build` or `yarn build`.
39+
-->
40+
</body>
41+
</html>

Diff for: public/manifest.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

Diff for: src/App.css

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.App {
2+
text-align: center;
3+
}
4+
.list-group{
5+
width: 400px;
6+
margin: 10px auto;
7+
box-shadow: 0 10px 20px #ccc;
8+
border: 2px solid rgb(39, 155, 35);
9+
border-radius: 9px;
10+
11+
}
12+
/* .list-group-item-red{
13+
min-height: 90px;
14+
background: red;
15+
} */
16+
.list-group-out{
17+
width: 500px;
18+
margin: 10px auto;
19+
border: 1px solid rgb(127, 127, 127);
20+
border-radius: 5px;
21+
padding: 0px 0px 15px 0px;
22+
-webkit-box-shadow: 0 10px 6px -6px #777;
23+
-moz-box-shadow: 0 10px 6px -6px #777;
24+
box-shadow: 0 10px 6px -6px #777;
25+
}
26+
.list-group-item{
27+
min-height: 90px;
28+
}
29+
.answer{
30+
margin: -13px 0px 18px 0px;
31+
}
32+
ul{
33+
list-style: none;
34+
}

Diff for: src/App.js

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import React, { Component } from 'react';
2+
import './App.css';
3+
import Question from './Components/question';
4+
5+
class App extends Component {
6+
constructor(props){
7+
super(props)
8+
this.state={
9+
questionId:111,
10+
questions:[
11+
{
12+
id:1,
13+
questionText:"Who is Primeminister of Bangladesh",
14+
choices:['Shekh hasina','Jillu Rahman','Ziaur Rahman','Khaleda Zia'],
15+
answer:['Shekh hasina'],
16+
isAnswer:false,isWrong:false
17+
},
18+
{
19+
id:2,
20+
questionText:"Who is Primeminister of woganda",
21+
choices:['chan chan lue','Jillu Rahman','Ziaur Rahman','Khaleda Zia'],
22+
answer:['chan chan lue'],
23+
isAnswer:false,
24+
isRight:false
25+
},
26+
{
27+
id:3,
28+
questionText:"বাংলাদেশের কতগুলো জেলা আছে ? ",
29+
choices:['৬৭ টি','৬৬ টি','৬৪ টি','৬২ টি'],
30+
answer:['৬৪ টি'],
31+
isAnswer:false,isWrong:false
32+
},
33+
],
34+
isStart:false,point:'',
35+
}
36+
}
37+
///methods
38+
chackChangedHandler=(event,id,answer)=>{
39+
const fIndex=this.state.questions.findIndex(p=>{
40+
return p.id===id;
41+
})
42+
43+
if(event.target.value===answer){
44+
const qu={
45+
...this.state.questions[fIndex]
46+
}
47+
qu.isAnswer=true;
48+
qu.isRight=true;
49+
const ques=[...this.state.questions]
50+
ques[fIndex]=qu;
51+
console.log(qu.isAnswer);
52+
this.setState({
53+
questions:ques
54+
})
55+
}else{
56+
const qu={
57+
...this.state.questions[fIndex]
58+
}
59+
qu.isAnswer=true;
60+
qu.isRight=false;
61+
const ques=[...this.state.questions]
62+
ques[fIndex]=qu;
63+
// console.log(qu.isAnswer);
64+
this.setState({
65+
questions:ques
66+
})
67+
}
68+
// console.log(this.state.questions[fIndex].isAnswer);
69+
}
70+
startExam=()=>{
71+
const st=this.state.isStart;
72+
this.setState({
73+
isStart:!st
74+
})
75+
}
76+
endExam=(qId)=>{
77+
if(this.state.questionId===qId){
78+
console.log('why this is fired?');
79+
}
80+
}
81+
///methods end
82+
render() {
83+
let output=null,btnoutput=null;
84+
if(!this.state.isStart){
85+
btnoutput=(
86+
<div>
87+
<button
88+
className="btn btn-outline-success"
89+
style={{float:'',margin:'9px',minHeight:''}}
90+
onClick={this.startExam}
91+
>Start</button>
92+
</div>
93+
)
94+
}
95+
if(this.state.isStart){
96+
output=(
97+
<div>
98+
{this.state.questions.map(q=>{
99+
return <Question
100+
key={q.id}
101+
qId={q.id}
102+
qText={q.questionText}
103+
qChoices={q.choices}
104+
qIsAnswer={q.isAnswer}
105+
qIsRight={q.isRight}
106+
chackChanged={event=>this.chackChangedHandler(event,q.id,q.answer[0])}
107+
/>
108+
})}
109+
<div>
110+
<button
111+
onClick={()=>this.endExam(this.state.questionId)}
112+
className="btn btn-danger"
113+
>End Exam</button>
114+
</div>
115+
</div>
116+
)
117+
}
118+
119+
return (
120+
<div className="App container list-group-out">
121+
<div>
122+
<h5 style={{float:'left',padding:'5px',minHeight:'70px',margin:'9px'}}>Exam Name : MCQ</h5>
123+
{btnoutput}
124+
{output}
125+
</div>
126+
</div>
127+
);
128+
}
129+
}
130+
131+
export default App;
132+
133+

Diff for: src/App.test.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './App';
4+
5+
it('renders without crashing', () => {
6+
const div = document.createElement('div');
7+
ReactDOM.render(<App />, div);
8+
ReactDOM.unmountComponentAtNode(div);
9+
});

Diff for: src/Components/question.css

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* .list-group{
2+
width: 50%;
3+
margin: 10px auto;
4+
box-shadow: 0 20px 20px #eee;
5+
}
6+
.list-group-item{
7+
min-height: 90px;
8+
}
9+
.answer{
10+
margin: -13px 0px 18px 0px;
11+
}
12+
ul{
13+
text-decoration: none;
14+
} */

0 commit comments

Comments
 (0)