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

add goup active index and group navigation to panel api #1115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -882,6 +882,9 @@ class SlideshowView extends React.Component {
getActiveItemIndex: () => {
return this.state.activeIndex;
},
getActiveGroupIndex: () => {
return this.getCenteredItemOrGroupIdxByScroll('groups');
Copy link
Collaborator

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.

},
triggerItemAction: (e, { itemIndex = this.state.activeIndex } = {}) => {
const galleryConfig = this.createGalleryConfig();
const item = this.props.galleryStructure.galleryItems[itemIndex % this.props.totalItemsCount];
Expand All @@ -892,6 +895,20 @@ class SlideshowView extends React.Component {

this.props.actions.eventsListener(GALLERY_CONSTS.events.ITEM_ACTION_TRIGGERED, props, e);
},
scrollToGroupIndex: (idx) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is this used? Please add a description on the PR.

Choose a reason for hiding this comment

The 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,
Expand Down