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(components/molecule/photoUploader): add new prop onSortPhotoEnd … #2779

Merged
merged 1 commit into from
Nov 11, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {PREVIEW_CARD_CLASS_NAME} from './config.js'
const PhotosPreview = ({
_callbackPhotosUploaded,
_onSortPhotoStart,
_onSortPhotoEnd,
_scrollToBottom,
addMorePhotosIcon,
addPhotoTextSkeleton,
Expand All @@ -53,6 +54,7 @@ const PhotosPreview = ({
}) => {
const _onSortEnd = event => {
_callbackPhotosUploaded(files, {action: ACTIONS.SORT, data: event})
_onSortPhotoEnd(event)
}

const _onSortStart = event => {
Expand Down Expand Up @@ -216,6 +218,7 @@ PhotosPreview.displayName = 'PhotosPreview'
PhotosPreview.propTypes = {
_callbackPhotosUploaded: PropTypes.func.isRequired,
_onSortPhotoStart: PropTypes.func.isRequired,
_onSortPhotoEnd: PropTypes.func.isRequired,
_scrollToBottom: PropTypes.func.isRequired,
addMorePhotosIcon: PropTypes.node.isRequired,
addPhotoTextSkeleton: PropTypes.string.isRequired,
Expand Down
9 changes: 9 additions & 0 deletions components/molecule/photoUploader/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const MoleculePhotoUploader = forwardRef(
onFileDialogOpen = noop,
onEmptyViewClick = noop,
onSortPhotoStart = noop,
onSortPhotoEnd = noop,
outputImageAspectRatio = DEFAULT_IMAGE_ASPECT_RATIO,
outputImageAspectRatioDisabled = false,
rejectPhotosIcon,
Expand Down Expand Up @@ -266,6 +267,10 @@ const MoleculePhotoUploader = forwardRef(
onSortPhotoStart()
}

const _onSortPhotoEnd = () => {
onSortPhotoEnd()
}

return (
<>
<div className={mainClassName}>
Expand All @@ -287,6 +292,7 @@ const MoleculePhotoUploader = forwardRef(
)}
{!isPhotoUploaderEmpty && (
<PhotosPreview
_onSortPhotoEnd={_onSortPhotoEnd}
_onSortPhotoStart={_onSortPhotoStart}
_callbackPhotosUploaded={_callbackPhotosUploaded}
_scrollToBottom={_scrollToBottom}
Expand Down Expand Up @@ -538,6 +544,9 @@ MoleculePhotoUploader.propTypes = {
/** Func to be executed when photo is being sorted */
onSortPhotoStart: PropTypes.func,

/** Func to be executed when photo is sorted */
onSortPhotoEnd: PropTypes.func,

/** A boolean to enable click in dropzone area */
isClickable: PropTypes.bool,

Expand Down
Loading