UNPKG

react-fex-gallery

Version:

React gallery powered by FEX.net API

116 lines (115 loc) 3.32 kB
import { ReactNode } from 'react'; export interface Image { crc32: string; created_at: number; download_url: string; has_children?: boolean; id: number; is_dir?: boolean; is_favorite?: boolean; is_public: true; mimetype: string; name: string; parent_id: number; play_url: string; preview_url: string; shared_links: string[]; size: number; updated_at: number; } export interface IFexApiResponse { children: Image[]; pagination: { count: number; page: number; pages: number; per_page: number; }; } export interface IState { currentIndex: number; view: 'grid' | 'gallery' | 'list' | 'viewer'; prevView?: IState['view']; infoForImage?: Image; images: Image[]; showInfo: boolean; imagesCount: number; selectedImages: Image[]; contentText: IContentText; accessRights: 'full' | 'read'; showOnlySelected?: boolean; folderName: string; methods: { onClose?: IProps['onClose']; onReachEnd?: IProps['onReachEnd']; onToggleViewCallback?: IProps['onToggleViewCallback']; onSelectImage?: IProps['onSelectImage']; onCopyImages?: IProps['onCopyImages']; onDownloadImages?: IProps['onDownloadImages']; onPrintImages?: IProps['onPrintImages']; onDeleteImages?: IProps['onDeleteImages']; onShareImage?: IProps['onShareImage']; }; isMobile?: boolean; searchQuery?: string; apiEndpointPagination?: IFexApiResponse['pagination']; apiEndpoint?: string; notifier?: string; topViewerPromoBanner?: ReactNode; bottomViewerPromoBanner?: ReactNode; } export interface IContentText { highlighted: string; pluralize: { image: { one: string; two: string; five: string; }; }; showHighlighted: string; showAll: string; show: string; clearHighlighted: string; download: string; copy: string; print: string; fileInfo: string; delete: string; search: string; close: string; highlightedSearch: string; loadingImages: string; fileProperties: string; size: string; created: string; fileExtension: string; } export interface IProps { images?: Image[]; onReachEnd?: (fetchAll?: boolean) => Promise<Image[] | undefined>; apiEndpoint?: string; onClose?: () => void; currentIndex?: number; showInfoPanel?: boolean; defaultView?: IState['view']; zIndex?: number; isMobile?: boolean; count?: number; contentText?: IContentText; accessRights?: IState['accessRights']; folderName: string; onToggleViewCallback?: (view: IState['view']) => void; onSelectImage?: (image: Image) => void; onCopyImages?: (images: Image[]) => void; onDownloadImages?: (images: Image[]) => void; onPrintImages?: (images: Image[]) => void; onDeleteImages?: (images: Image[]) => Promise<{ count?: number; newIndex?: number; images?: Image[]; } | undefined>; onShareImage?: (image: Image) => void; topViewerPromoBanner?: ReactNode; bottomViewerPromoBanner?: ReactNode; }