Toggle navigation
Toggle navigation
This project
Loading...
Sign in
한우준
/
Straight-Up
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
MrMirror21
2020-12-10 03:03:37 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
13b49b2f1c9e40d173cf37b83e34f60581c2bcb7
13b49b2f
1 parent
3db03f1c
add user choice for position of photos
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
straight-up/src/Main.js
straight-up/src/components/Checkbox.js
straight-up/src/Main.js
View file @
13b49b2
import
React
,
{
useState
}
from
'react'
import
{
useSetRecoilState
}
from
'recoil'
;
import
{
use
RecoilState
,
use
SetRecoilState
}
from
'recoil'
;
import
Header
from
'./components/Header'
;
import
Checkbox
from
'./components/Checkbox'
;
import
checkStraight
from
'./AnalysisPose'
;
import
{
analysisResultState
}
from
'./store/Global'
;
import
{
selectedPosState
,
analysisResultState
}
from
'./store/Global'
;
import
'./style/Main.css'
;
require
(
'dotenv'
).
config
();
...
...
@@ -15,6 +16,7 @@ export default function Main() {
const
[
imgBase64
,
setImgBase64
]
=
useState
(
""
);
const
[
img
,
setImage
]
=
useState
(
null
);
const
setAnalysisResult
=
useSetRecoilState
(
analysisResultState
);
const
[
selectedPosition
,
setPosition
]
=
useRecoilState
(
selectedPosState
);
const
handleChangeFile
=
(
event
)
=>
{
let
reader
=
new
FileReader
();
reader
.
onloadend
=
()
=>
{
...
...
@@ -73,6 +75,12 @@ export default function Main() {
<
/div>
<
div
className
=
"Image_input"
>
<
input
type
=
"file"
name
=
"file"
onChange
=
{
handleChangeFile
}
/>
<
div
className
=
"position-selector"
>
<
h3
>
전면
사진
<
/h3>
<
Checkbox
checked
=
{
selectedPosition
===
"front"
}
onChange
=
{(
isChecked
)
=>
{
isChecked
?
setPosition
(
'front'
)
:
setPosition
(
'side'
)}}
/>
<
h3
>
측면
사진
<
/h3>
<
Checkbox
checked
=
{
selectedPosition
===
"side"
}
onChange
=
{(
isChecked
)
=>
{
isChecked
?
setPosition
(
'side'
)
:
setPosition
(
'front'
)}}
/>
<
/div>
<
button
type
=
"button"
onClick
=
{
analysisImage
}
>
Submit
<
/button>
<
/div>
<
/div>
...
...
straight-up/src/components/Checkbox.js
0 → 100644
View file @
13b49b2
import
React
from
'react'
const
Checkbox
=
(
props
)
=>
{
return
(
<
input
type
=
"checkbox"
checked
=
{
props
.
checked
}
onChange
=
{(
e
)
=>
props
.
onChange
(
e
.
target
.
checked
)}
/>
)
}
export
default
Checkbox
;
\ No newline at end of file
Please
register
or
login
to post a comment