1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

#58 fixed upload buttons

This commit is contained in:
Fedor Katurov 2021-03-29 09:27:49 +07:00
parent b871cc2042
commit 97958a358b
4 changed files with 14 additions and 18 deletions

View file

@ -5,6 +5,8 @@ import { UPLOAD_TYPES } from '~/redux/uploads/constants';
import { IEditorComponentProps } from '~/redux/node/types';
import { useFileUploaderContext } from '~/utils/hooks/fileUploader';
import { getFileType } from '~/utils/uploader';
import { useNodeFormContext } from '~/utils/hooks/useNodeFormFormik';
import { Button } from '~/components/input/Button';
type IProps = IEditorComponentProps & {
accept?: string;
@ -18,6 +20,7 @@ const EditorUploadButton: FC<IProps> = ({
type = UPLOAD_TYPES.IMAGE,
}) => {
const { uploadFiles } = useFileUploaderContext()!;
const { values } = useNodeFormContext();
const onInputChange = useCallback(
(event: ChangeEvent<HTMLInputElement>) => {
@ -33,13 +36,10 @@ const EditorUploadButton: FC<IProps> = ({
);
return (
<div className={styles.wrap}>
<Button type="button" round size="giant" className={styles.wrap}>
<Icon icon={icon} size={24} />
<input type="file" onChange={onInputChange} accept={accept} multiple />
<div className={styles.icon}>
<Icon size={32} icon={icon} />
</div>
</div>
</Button>
);
};

View file

@ -1,15 +1,7 @@
@import "src/styles/variables";
.wrap {
@include outer_shadow();
@include editor_round_button();
transition: opacity 0.5s;
background: $red_gradient;
&:hover {
opacity: 1;
}
position: relative;
input {
width: 100%;