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

#58 fixed upload buttons appearance

This commit is contained in:
Fedor Katurov 2021-03-29 09:37:13 +07:00
parent 97958a358b
commit d9af895558
3 changed files with 17 additions and 3 deletions

View file

@ -6,7 +6,12 @@ import { IEditorComponentProps } from '~/redux/node/types';
type IProps = IEditorComponentProps & {};
const EditorAudioUploadButton: FC<IProps> = () => (
<EditorUploadButton accept="audio/*" icon="audio" type={UPLOAD_TYPES.AUDIO} />
<EditorUploadButton
accept="audio/*"
icon="audio"
type={UPLOAD_TYPES.AUDIO}
label="Добавить аудио"
/>
);
export { EditorAudioUploadButton };

View file

@ -6,7 +6,12 @@ import { IEditorComponentProps } from '~/redux/node/types';
type IProps = IEditorComponentProps & {};
const EditorImageUploadButton: FC<IProps> = () => (
<EditorUploadButton accept="image/*" icon="image" type={UPLOAD_TYPES.IMAGE} />
<EditorUploadButton
accept="image/*"
icon="image"
type={UPLOAD_TYPES.IMAGE}
label="Добавить фоточек"
/>
);
export { EditorImageUploadButton };

View file

@ -12,12 +12,14 @@ type IProps = IEditorComponentProps & {
accept?: string;
icon?: string;
type?: typeof UPLOAD_TYPES[keyof typeof UPLOAD_TYPES];
label?: string;
};
const EditorUploadButton: FC<IProps> = ({
accept = 'image/*',
icon = 'plus',
type = UPLOAD_TYPES.IMAGE,
label,
}) => {
const { uploadFiles } = useFileUploaderContext()!;
const { values } = useNodeFormContext();
@ -35,8 +37,10 @@ const EditorUploadButton: FC<IProps> = ({
[uploadFiles]
);
const color = values.is_promoted ? 'primary' : 'lab';
return (
<Button type="button" round size="giant" className={styles.wrap}>
<Button type="button" round size="giant" className={styles.wrap} label={label} color={color}>
<Icon icon={icon} size={24} />
<input type="file" onChange={onInputChange} accept={accept} multiple />
</Button>