fix: type 오류 fix
parent
01b819e35d
commit
e7e7957507
@ -1,4 +0,0 @@
|
||||
REACT_APP_VERSION = v0.0.1
|
||||
#REACT_APP_API_URL=http://211.119.124.9:8090
|
||||
REACT_APP_API_URL=http://localhost:8090
|
||||
REACT_APP_SERVER_TIMEOUT=6000
|
@ -0,0 +1,4 @@
|
||||
REACT_APP_MODE=production
|
||||
REACT_APP_VERSION = v0.0.1
|
||||
REACT_APP_API_URL=http://211.119.124.9:8090
|
||||
REACT_APP_SERVER_TIMEOUT=6000
|
@ -0,0 +1,45 @@
|
||||
import { Button, Grid, TextField, Typography } from '@mui/material';
|
||||
import { FileUpload } from '@mui/icons-material';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const FileReadInputForm = ({ labelName, selectedFile, handleChangeFile, alert }) => {
|
||||
const onChangeFile = (e) => {
|
||||
const file = e.target.files[0];
|
||||
if (file.type.includes('image')) {
|
||||
alert.show(<img alt={`${file.name}`} src={URL.createObjectURL(file)} style={{ margin: 'auto' }} />);
|
||||
}
|
||||
handleChangeFile(file);
|
||||
};
|
||||
|
||||
return (
|
||||
<Grid container item spacing={0.5}>
|
||||
<Grid item xs={12} sm={7.5}>
|
||||
<TextField
|
||||
placeholder={labelName}
|
||||
value={selectedFile}
|
||||
size="small"
|
||||
startIcon={<FileUpload stroke={1.5} size="1rem" />}
|
||||
onClick={() => {}}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm={4.5}>
|
||||
<Button variant="contained" component="label" color="primary" size="small" startIcon={<FileUpload stroke={1.5} size="1rem" />}>
|
||||
파일
|
||||
<input type="file" hidden onChange={onChangeFile} />
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Typography variant="h4">{selectedFile}</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
||||
FileReadInputForm.propTypes = {
|
||||
labelName: PropTypes.number.isRequired,
|
||||
selectedFile: PropTypes.string,
|
||||
handleChangeFile: PropTypes.func.isRequired,
|
||||
alert: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default FileReadInputForm;
|
Loading…
Reference in New Issue