feat: Add ImageInput component
This commit is contained in:
parent
fd1fcba2a0
commit
fc6d02bef7
19
src/components/ImageInput/index.jsx
Normal file
19
src/components/ImageInput/index.jsx
Normal file
@ -0,0 +1,19 @@
|
||||
import * as S from '../../styles/ImageInput.styles';
|
||||
|
||||
function ImageInput({ id, multiple = false, onChange }) {
|
||||
const htmlId = id ?? 'image-input';
|
||||
return (
|
||||
<S.ImageInput>
|
||||
<S.ImageInputLabel htmlFor={htmlId}>파일 선택</S.ImageInputLabel>
|
||||
<S.ImageInputField
|
||||
id={htmlId}
|
||||
type="file"
|
||||
accept="image/jpg, image/png, image/jpeg"
|
||||
multiple={multiple}
|
||||
onChange={onChange}
|
||||
/>
|
||||
</S.ImageInput>
|
||||
);
|
||||
}
|
||||
|
||||
export default ImageInput;
|
19
src/styles/ImageInput.styles.js
Normal file
19
src/styles/ImageInput.styles.js
Normal file
@ -0,0 +1,19 @@
|
||||
import styled from 'styled-components';
|
||||
|
||||
export const ImageInput = styled.div`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
`;
|
||||
|
||||
export const ImageInputLabel = styled.label`
|
||||
${({ theme }) => theme.boxShadow};
|
||||
cursor: pointer;
|
||||
`;
|
||||
|
||||
export const ImageInputField = styled.input`
|
||||
cursor: pointer;
|
||||
&::file-selector-button {
|
||||
display: none;
|
||||
}
|
||||
`;
|
Loading…
Reference in New Issue
Block a user