Skip to content

Commit cc31954

Browse files
committed
Update dropZone to be clickable to load image
1 parent faa13e5 commit cc31954

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/App.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function App() {
200200
setNotifOpen(true)
201201
}
202202
}, [])
203-
const {getRootProps, isDragActive} = useDropzone({onDrop})
203+
const {getRootProps, getInputProps, isDragActive} = useDropzone({onDrop})
204204

205205
const handleClose = (event: SyntheticEvent, reason?: SnackbarCloseReason) => {
206206
if (reason === 'clickaway') {
@@ -271,15 +271,15 @@ function App() {
271271
<Grid container>
272272
<Grid item xs={2}/>
273273
<Grid item xs={4}>
274-
<Card {...getRootProps()} className={classes.imageBox}>
275-
<CardContent {...getRootProps()} >
274+
<Card className={classes.imageBox}>
275+
<CardContent>
276276
<Typography gutterBottom variant="h5" component="div">Original Image</Typography>
277277
</CardContent>
278278
<div {...getRootProps()} className={classes.selectBox}
279279
style={{border: isDragActive ? '2px dashed green' : '2px dashed grey'}}>
280280
{imageSrc !== "" ?
281-
<img alt="original" src={imageSrc} style={{maxHeight: 160, maxWidth: 160}}/> :
282-
<p>Drop the image here</p>
281+
<div><input {...getInputProps()} /><img alt="original" src={imageSrc} style={{maxHeight: 160, maxWidth: 160}}/></div> :
282+
<div><input {...getInputProps()} /><p>Drop the image here or click to load</p></div>
283283
}
284284
</div>
285285
</Card>

0 commit comments

Comments
 (0)