-
Notifications
You must be signed in to change notification settings - Fork 36
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
add goup active index and group navigation to panel api #1115
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -882,6 +882,9 @@ class SlideshowView extends React.Component { | |
getActiveItemIndex: () => { | ||
return this.state.activeIndex; | ||
}, | ||
getActiveGroupIndex: () => { | ||
return this.getCenteredItemOrGroupIdxByScroll('groups'); | ||
}, | ||
triggerItemAction: (e, { itemIndex = this.state.activeIndex } = {}) => { | ||
const galleryConfig = this.createGalleryConfig(); | ||
const item = this.props.galleryStructure.galleryItems[itemIndex % this.props.totalItemsCount]; | ||
|
@@ -892,6 +895,20 @@ class SlideshowView extends React.Component { | |
|
||
this.props.actions.eventsListener(GALLERY_CONSTS.events.ITEM_ACTION_TRIGGERED, props, e); | ||
}, | ||
scrollToGroupIndex: (idx) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When is this used? Please add a description on the PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding Group Active Index and Group Navigation to the Panel API would be a fantastic enhancement! This feature could streamline navigation and provide developers with better control over grouped components, ensuring a smoother user experience and more organized UI management. |
||
const activeGroup = this.getCenteredItemOrGroupIdxByScroll('groups'); | ||
const direction = idx - activeGroup; | ||
const scrollingUpTheGallery = isRTL | ||
? direction <= -1 | ||
: direction >= 1; | ||
this.scrollToItemOrGroup( | ||
this.props.actions.scrollToGroup, | ||
idx, | ||
false, | ||
400, | ||
scrollingUpTheGallery | ||
); | ||
}, | ||
// nextGroup, | ||
// previousItem, | ||
// previousGroup, | ||
|
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.
Why would this be different than line 883?
Why isnt this a state? this calculation should not be triggered by request, but by change.