-
Notifications
You must be signed in to change notification settings - Fork 317
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(file-uploader): Prop to turn off or on images in Tracker #2988
Conversation
|
@@ -23,6 +23,7 @@ export function FileUploader({ | |||
multiple = true, | |||
onError, | |||
onSuccess, | |||
showImages = true, |
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.
Defaults to true
errorMessage={status?.fileErrors} | ||
file={status.file} | ||
hasImage={status.file?.type.startsWith('image/')} | ||
url={URL.createObjectURL(status.file)} | ||
fileState={status?.fileState} | ||
hasImage={status.file?.type.startsWith('image/') && showImages} | ||
key={index} | ||
onChange={onNameChange(index)} | ||
name={status.name} | ||
onCancel={onFileCancel(index)} | ||
onCancelEdit={onCancelEdit(index)} | ||
onChange={onNameChange(index)} | ||
onDelete={onDelete} |
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.
I resorted these alphabetically
file, | ||
fileState, | ||
hasImage, | ||
url, | ||
name, | ||
onCancel, | ||
onCancelEdit, | ||
onPause, |
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.
Resorted Alphabetically
onCancelEdit?: () => void; | ||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void; | ||
onDelete?: () => void; |
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.
Resorted alphabetically too , that's the only change here
hasImage={status.file?.type.startsWith('image/')} | ||
url={URL.createObjectURL(status.file)} | ||
fileState={status?.fileState} | ||
hasImage={status.file?.type.startsWith('image/') && showImages} |
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.
This the change I added. So now it has to have an image and showImages has to be true.
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.
I think we need to change this logic a bit. I was thinking this prop would show or hide both the image and file icon depending if it is true or false. If showImages
is true, there will always be either an image or icon. If showImages
is false, no image or icon will appear. Does that make sense?
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.
OK! @dbanksdesign I can make it so it doesn't show the icon either!
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.
Fixed in cf8a443
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.
Looks good, just one clarification
hasImage={status.file?.type.startsWith('image/')} | ||
url={URL.createObjectURL(status.file)} | ||
fileState={status?.fileState} | ||
hasImage={status.file?.type.startsWith('image/') && showImages} |
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.
I think we need to change this logic a bit. I was thinking this prop would show or hide both the image and file icon depending if it is true or false. If showImages
is true, there will always be either an image or icon. If showImages
is false, no image or icon will appear. Does that make sense?
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.
One non-blocking nit. LGTM!
) : ( | ||
'' | ||
)} |
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.
) : ( | |
'' | |
)} | |
) : null} |
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.
OK! I'll fix it really quickly
Description of changes
This new prop allows customers to turn on or off images to display in the tracker component
Issue #, if available
Asana
Description of how you validated changes
Add test
Checklist
yarn test
passessideEffects
field updatedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.