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

move thumbnails logic to lib #1242

Open
wants to merge 3 commits into
base: V4_Final
Choose a base branch
from
Open
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 @@ -3,10 +3,7 @@ import { GALLERY_CONSTS, utils } from 'pro-gallery-lib';

import TextItem from '../../item/textItem.js';

import {
getThumbnailsData,
clearGalleryItems,
} from '../../helpers/thumbnailsLogic';
import { thumbnailsLogic } from 'pro-gallery-lib';

const ENTER_KEY = 'Enter';

Expand All @@ -27,7 +24,7 @@ class NavigationPanel extends React.Component {
galleryStructure,
settings,
}) {
const clearedGalleryItems = clearGalleryItems(
const clearedGalleryItems = thumbnailsLogic.clearGalleryItems(
this.props.items,
this.props.galleryStructure.galleryItems
);
Expand All @@ -42,7 +39,7 @@ class NavigationPanel extends React.Component {
thumbnailsMargins,
thumbnailsStyle,
activeIndexOffsetMemory,
} = getThumbnailsData({
} = thumbnailsLogic.getThumbnailsData({
items: this.props.items,
activeIndex,
options,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { GalleryProps, GALLERY_CONSTS, utils } from 'pro-gallery-lib';
import { default as GALLERY_CONSTS } from '../../common/constants/index';
import utils from '../../common/utils';
import { GalleryProps } from '../../common/interfaces/galleryTypes';
import { CSSProperties } from 'react';

function calculateActiveIndexOffset({
Expand Down Expand Up @@ -272,3 +274,13 @@ function getThumbnailLocation({
[isRTL ? 'bottom' : 'top']: offsetSize,
};
}
export default {
getThumbnailsData,
getThumbnailsContainerSize,
getNumberOfThumbnails,
getThumbnailsStyles,
getThumbnailsContainerMargin,
getThumbnailLocation,
calculateActiveIndexOffset,
clearGalleryItems,
};
1 change: 1 addition & 0 deletions packages/lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ export { GalleryProps, GalleryState } from './common/interfaces/galleryTypes';
export { Options } from './common/interfaces/options';
export { GalleryRendererProps } from './common/interfaces/galleryRendererTypes';
export { VirtualizationSettings } from './common/interfaces/virtualization';
export { default as thumbnailsLogic } from './core/helpers/thumbnailsLogic';
Loading