From 222c12fcf25f517a407b8687ecf09906042ec21a Mon Sep 17 00:00:00 2001 From: IzaacAyelin Date: Tue, 28 May 2024 10:44:00 +0300 Subject: [PATCH] move thumbnails logic to lib --- .../components/gallery/proGallery/navigationPanel.js | 5 +---- .../src/core}/helpers/thumbnailsLogic.ts | 10 ++++++++++ packages/lib/src/index.ts | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) rename packages/{gallery/src/components => lib/src/core}/helpers/thumbnailsLogic.ts (97%) diff --git a/packages/gallery/src/components/gallery/proGallery/navigationPanel.js b/packages/gallery/src/components/gallery/proGallery/navigationPanel.js index 21db4c6d91..d102b491ae 100644 --- a/packages/gallery/src/components/gallery/proGallery/navigationPanel.js +++ b/packages/gallery/src/components/gallery/proGallery/navigationPanel.js @@ -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 { getThumbnailsData, clearGalleryItems } from 'pro-gallery-lib'; const ENTER_KEY = 'Enter'; diff --git a/packages/gallery/src/components/helpers/thumbnailsLogic.ts b/packages/lib/src/core/helpers/thumbnailsLogic.ts similarity index 97% rename from packages/gallery/src/components/helpers/thumbnailsLogic.ts rename to packages/lib/src/core/helpers/thumbnailsLogic.ts index ea14dfc4ad..258a537f3a 100644 --- a/packages/gallery/src/components/helpers/thumbnailsLogic.ts +++ b/packages/lib/src/core/helpers/thumbnailsLogic.ts @@ -272,3 +272,13 @@ function getThumbnailLocation({ [isRTL ? 'bottom' : 'top']: offsetSize, }; } +export default { + getThumbnailsData, + getThumbnailsContainerSize, + getNumberOfThumbnails, + getThumbnailsStyles, + getThumbnailsContainerMargin, + getThumbnailLocation, + calculateActiveIndexOffset, + clearGalleryItems, +}; diff --git a/packages/lib/src/index.ts b/packages/lib/src/index.ts index 0b3e9db746..30862a89cc 100644 --- a/packages/lib/src/index.ts +++ b/packages/lib/src/index.ts @@ -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';