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 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 & {}; type IProps = IEditorComponentProps & {};
const EditorAudioUploadButton: FC<IProps> = () => ( 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 }; export { EditorAudioUploadButton };

View file

@ -6,7 +6,12 @@ import { IEditorComponentProps } from '~/redux/node/types';
type IProps = IEditorComponentProps & {}; type IProps = IEditorComponentProps & {};
const EditorImageUploadButton: FC<IProps> = () => ( 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 }; export { EditorImageUploadButton };

View file

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