mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
#58 fixed upload buttons appearance
This commit is contained in:
parent
97958a358b
commit
d9af895558
3 changed files with 17 additions and 3 deletions
|
@ -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 };
|
||||||
|
|
|
@ -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 };
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue