Skip to content

Commit

Permalink
add tooltip and icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Maaksaa committed Nov 13, 2024
1 parent aa90de4 commit 19047ee
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InboxOutlined } from '@ant-design/icons';
import { Form, Upload, message } from 'antd';
import { InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { Form, Upload, message, Tooltip } from 'antd';
import { QuestionItemProps } from 'sdc-qrf';

import { isSuccess } from '@beda.software/remote-data';
Expand Down Expand Up @@ -51,10 +51,10 @@ async function fetchDownloadUrl(filename: string) {
}

export function UploadFileControl({ parentPath, questionItem }: UploadFileProps) {
const { linkId, text } = questionItem;
const { linkId, text, helpText } = questionItem;
const fieldName = [...parentPath, linkId, 0, 'value'];
const { formItem } = useFieldController(fieldName, questionItem);

const props = {
name: 'file',
multiple: true,
Expand Down Expand Up @@ -90,7 +90,16 @@ export function UploadFileControl({ parentPath, questionItem }: UploadFileProps)
};

return (
<Form.Item {...formItem} label={text}>
<Form.Item {...formItem} label={
<span>
{text}{' '}
{helpText && (
<Tooltip title={helpText}>
<QuestionCircleOutlined />
</Tooltip>
)}
</span>
}>
<Dragger {...props}>

Check failure on line 103 in src/components/BaseQuestionnaireResponseForm/widgets/UploadFileControl/index.tsx

View workflow job for this annotation

GitHub Actions / Tests

Type '{ children: Element[]; name: string; multiple: boolean; customRequest: (options: CustomRequestOptions) => Promise<void>; onChange(info: { file: { name?: string | undefined; status?: string | undefined; }; }): void; onDrop(e: { ...; }): void; }' is not assignable to type 'UploadProps<any>'.
<p className="ant-upload-drag-icon">
<InboxOutlined />
Expand Down

0 comments on commit 19047ee

Please sign in to comment.