Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add hint for upload image and file #449

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/forms/FileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type FileFormProps = ClassNameProps & {
onCancel(): void;
onAttach?: (files: File[]) => void;
loading?: boolean;
uploadHint?: string;
};

export const FileForm: React.FC<FileFormProps> = ({
Expand All @@ -38,6 +39,7 @@ export const FileForm: React.FC<FileFormProps> = ({
onSubmit,
onAttach,
loading,
uploadHint,
}) => {
const [tabId, setTabId] = React.useState<string>(() =>
isFunction(onAttach) ? TabId.Attach : TabId.Link,
Expand Down Expand Up @@ -74,7 +76,7 @@ export const FileForm: React.FC<FileFormProps> = ({
)}
{tabId === TabId.Attach && onAttach && (
<>
<Form.Layout>{i18n('file_upload_help')}</Form.Layout>
<Form.Layout>{uploadHint || i18n('file_upload_help')}</Form.Layout>
<Form.Footer onCancel={onCancel}>
<ButtonAttach
multiple
Expand Down
4 changes: 3 additions & 1 deletion src/forms/ImageForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export type ImageFormProps = ClassNameProps & {
onCancel(): void;
onAttach?: (files: File[]) => void;
loading?: boolean;
uploadHint?: string;
};

export const ImageForm: React.FC<ImageFormProps> = ({
Expand All @@ -43,6 +44,7 @@ export const ImageForm: React.FC<ImageFormProps> = ({
onSubmit,
onAttach,
loading,
uploadHint,
}) => {
const [tabId, setTabId] = React.useState<string>(() =>
isFunction(onAttach) ? ImageTabId.Attach : ImageTabId.Link,
Expand Down Expand Up @@ -86,7 +88,7 @@ export const ImageForm: React.FC<ImageFormProps> = ({
)}
{tabId === ImageTabId.Attach && onAttach && (
<>
<Form.Layout>{i18n('image_upload_help')}</Form.Layout>
<Form.Layout>{uploadHint || i18n('image_upload_help')}</Form.Layout>
<Form.Footer onCancel={onCancel}>
<ButtonAttach
multiple
Expand Down