-
Notifications
You must be signed in to change notification settings - Fork 85
(feat): O3-3685: Enable Deleting or Clearing Files in File Picker Component in Edit Mode #453
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
base: main
Are you sure you want to change the base?
Conversation
hey @samuelmale Please review this. Thanks |
@lucyjemutai Thanks for working on this! However, can we get some UX design advisory on how to refine the UI? In the demo, the delete button renders before the target blob. It also appears to render twice. Is it some kind of preview or thumbnail? |
{value && !isViewMode(sessionMode) && ( | ||
<div className={styles.attachmentContainer}> | ||
{(Array.isArray(value) ? value : [value]).map((file, index) => ( | ||
<div key={index} className={styles.attachmentPreview}> | ||
{file.bytesContentFamily === 'PDF' ? ( | ||
<div className={styles.pdfThumbnail}> | ||
<DocumentPdf size={24} /> | ||
</div> | ||
) : ( | ||
file.src && <img src={file.src} alt="Preview" width="200px" /> | ||
)} | ||
<div className={styles.trashCanContainer}> | ||
<span className={styles.trashTooltip}>{t('clearFile', 'Clear file')}</span> | ||
<TrashCan className={styles.trashIcon} onClick={handleDeleteAttachment} size={20} /> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lucyjemutai as @samuelmale has mentioned there is dual rendering of the images that are being uploaded one in the attachmentContainer (with the trash can icon) other in editModeImage (as a preview), in my suggestion it would be better to have the editModeImage removed and modify the attachmentContainer post this the discussion on the UX-design channel can made in the channel.
{value && !isViewMode(sessionMode) && ( | |
<div className={styles.attachmentContainer}> | |
{(Array.isArray(value) ? value : [value]).map((file, index) => ( | |
<div key={index} className={styles.attachmentPreview}> | |
{file.bytesContentFamily === 'PDF' ? ( | |
<div className={styles.pdfThumbnail}> | |
<DocumentPdf size={24} /> | |
</div> | |
) : ( | |
file.src && <img src={file.src} alt="Preview" width="200px" /> | |
)} | |
<div className={styles.trashCanContainer}> | |
<span className={styles.trashTooltip}>{t('clearFile', 'Clear file')}</span> | |
<TrashCan className={styles.trashIcon} onClick={handleDeleteAttachment} size={20} /> | |
</div> | |
</div> | |
))} | |
</div> | |
)} | |
{value && !isViewMode(sessionMode) && ( | |
<div className={styles.attachmentContainer}> | |
{(Array.isArray(value) ? value : [value]).map((file, index) => ( | |
<div key={index} className={styles.attachmentPreview}> | |
{file.bytesContentFamily === 'PDF' ? ( | |
<div className={styles.pdfThumbnail}> | |
<DocumentPdf size={24} /> | |
<div className={styles.trashCanContainer}> | |
<span className={styles.trashTooltip}>{t('clearFile', 'Clear file')}</span> | |
<TrashCan | |
className={styles.trashIcon} | |
onClick={handleDeleteAttachment} | |
size={20} | |
aria-label={t('clearFile', 'Clear file')} | |
role="button" | |
tabIndex={0} | |
/> | |
</div> | |
</div> | |
) : ( | |
file.src && ( | |
<div className={styles.imagePreview}> | |
<img src={file.src} alt="Preview" width="200px" /> | |
<div className={styles.trashCanContainer}> | |
<span className={styles.trashTooltip}>{t('clearFile', 'Clear file')}</span> | |
<TrashCan | |
className={styles.trashIcon} | |
onClick={handleDeleteAttachment} | |
size={20} | |
aria-label={t('clearFile', 'Clear file')} | |
role="button" | |
tabIndex={0} | |
/> | |
</div> | |
</div> | |
) | |
)} | |
</div> | |
))} | |
</div> | |
)} |
Requirements
Summary
https://openmrs.atlassian.net/browse/O3-3685
Screenshots
screen-recording-2024-12-19-at-115242_rgC1F8Gn.mov
Related Issue
Other