Skip to content

Commit

Permalink
Merge pull request #2779 from SUI-Components/feature/add-onSortPhotoE…
Browse files Browse the repository at this point in the history
…nd-prop-photouploader

feat(components/molecule/photoUploader): add new prop onSortPhotoEnd …
  • Loading branch information
davidmartin84 authored Nov 11, 2024
2 parents 076de46 + 778020e commit 3d292a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/molecule/photoUploader/src/PhotosPreview/index.js
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

0 comments on commit 3d292a5

Please sign in to comment.