Toggle navigation
Toggle navigation
This project
Loading...
Sign in
조수연
/
Find_your_own_personal_color
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이수빈
2020-11-29 10:36:34 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f3e733be32b81a1c82dd1b0ecb4e57193f5ef555
f3e733be
1 parent
2025720c
update test 2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
34 deletions
front/.eslintcache
front/src/test.js
front/.eslintcache
View file @
f3e733b
[{"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js":"1","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js":"2","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js":"3","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js":"4"},{"size":450,"mtime":1606585705558,"results":"5","hashOfConfig":"6"},{"size":493,"mtime":1606590087333,"results":"7","hashOfConfig":"6"},{"size":2683,"mtime":1606596439882,"results":"8","hashOfConfig":"6"},{"size":238,"mtime":1606589880919,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"pqxpq",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js",[]]
\ No newline at end of file
[{"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js":"1","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js":"2","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js":"3","C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js":"4"},{"size":450,"mtime":1606585705558,"results":"5","hashOfConfig":"6"},{"size":493,"mtime":1606590087333,"results":"7","hashOfConfig":"6"},{"size":2628,"mtime":1606613746724,"results":"8","hashOfConfig":"6"},{"size":238,"mtime":1606589880919,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"pqxpq",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\App.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\Home.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\test.js",[],"C:\\Users\\subin\\Desktop\\khuhub_color\\Find_your_own_personal_color\\front\\src\\index.js",[]]
\ No newline at end of file
...
...
front/src/test.js
View file @
f3e733b
//import React from 'react';
/*const test = ( { history } ) =>
{
return(
<div>
<h3>test </h3>
</div>
);
}*/
import
React
,
{
useState
}
from
'react'
;
import
'./test.css'
;
const
Test
=
(
{
history
}
)
=>
...
...
@@ -51,41 +39,47 @@ const Test = ( { history } ) =>
const
[
showScore
,
setShowScore
]
=
useState
(
false
);
const
[
score_c
,
setScore_cool
]
=
useState
(
0
);
const
[
score_w
,
setScore_warm
]
=
useState
(
0
);
var
score
=
''
;
const
[
score
,
setPersonal
]
=
useState
(
0
);
var
isTrue
=
0
;
const
handleAnswerOptionClick
=
(
isCorrect
)
=>
{
if
(
isCorrect
)
{
setScore_cool
(
score_c
+
1
);
setScore_cool
(
score_c
+
1
);
//c,c,w,w
}
else
{
setScore_warm
(
score_w
+
1
);
}
console
.
log
(
isCorrect
);
console
.
log
(
score_c
);
}
const
nextQuestion
=
currentQuestion
+
1
;
if
(
nextQuestion
<
questions
.
length
)
{
setCurrentQuestion
(
nextQuestion
);
}
else
{
setCurrentQuestion
(
nextQuestion
);
//0,0 -> 0,1 -> 1,2 -> 2,3
}
else
if
(
nextQuestion
===
questions
.
length
){
if
(
score_c
>
score_w
){
setPersonal
(
'cool'
);
}
else
if
(
score_c
<
score_w
){
setPersonal
(
'warm'
);
}
else
{
setPersonal
(
'restart'
);
}
isTrue
=
1
;
}
if
(
isTrue
===
1
)
{
setShowScore
(
true
);
}
if
(
score_c
>
score_w
){
score
=
'cool'
;
}
else
if
(
score_c
<
score_w
){
score
=
'warm'
;
}
else
{
score
=
'restart'
;
}
}
};
return
(
<
div
className
=
'app'
>
{
showScore
?
(
<
div
className
=
'score-section'
>
You
scored
{
score
}
out
of
{
questions
.
length
}
<
/
div
>
<
span
className
=
'score-section'
>
You
scored
{
currentQuestion
}{
questions
.
length
}{
score
}
out
of
{
questions
.
length
}
<
/
span
>
)
:
(
<>
<
div
className
=
'question-section'
>
...
...
Please
register
or
login
to post a comment