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:
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 & {};
|
||||
|
||||
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 };
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue