feat: Add ImageInput component

This commit is contained in:
jhynsoo 2023-10-25 18:19:14 +09:00
parent fd1fcba2a0
commit fc6d02bef7
2 changed files with 38 additions and 0 deletions

View 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;

View 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;
}
`;