diff --git a/package-lock.json b/package-lock.json index 211a5ac..ae77818 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-butterfly-map", - "version": "1.0.0-rc3", + "version": "1.0.0-rc4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "react-butterfly-map", - "version": "1.0.0-rc3", + "version": "1.0.0-rc4", "license": "MIT", "dependencies": { "maplibre-gl": "^4.7.1", diff --git a/package.json b/package.json index 1b08932..5ac404b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-butterfly-map", - "version": "1.0.0-rc3", + "version": "1.0.0-rc4", "license": "MIT", "private": false, "main": "dist/reactButterflyMap.umd.cjs", diff --git a/src/js/components/ButterflyMap.tsx b/src/js/components/ButterflyMap.tsx index a0d43e6..88147f2 100644 --- a/src/js/components/ButterflyMap.tsx +++ b/src/js/components/ButterflyMap.tsx @@ -42,7 +42,7 @@ const ButterflyMap = (props: ButterflyMapProps) => { React.useEffect(() => { let found = props.paginationPage === undefined; - for (const serverSideField of [props.setPaginationPage, props.entriesPerPage, props.setEntriesPerPage]) { + for (const serverSideField of [props.setPaginationPage, props.entriesPerPage, props.setEntriesPerPage, props.totalCount]) { if ((serverSideField === undefined) !== found) { throw new Error('react butterfly map error: When one of the server side pagination props is set, all of them have to be.'); } @@ -185,7 +185,7 @@ const ButterflyMap = (props: ButterflyMapProps) => { handlePoiClick={handlePoiClick} entriesPerPage={props.entriesPerPage} setEntriesPerPage={props.setEntriesPerPage} - />} + totalCount={props.totalCount}/>} ; }; @@ -202,6 +202,7 @@ type ButterflyMapProps = { setEntriesPerPage?: React.Dispatch>, paginationPage?: number, setPaginationPage?: React.Dispatch>, + totalCount?: number, } export default ButterflyMap; diff --git a/src/js/components/Pagination.tsx b/src/js/components/Pagination.tsx index cb1f87b..a2834fa 100644 --- a/src/js/components/Pagination.tsx +++ b/src/js/components/Pagination.tsx @@ -11,6 +11,7 @@ type PaginationProps = { setEntriesPerPage: React.Dispatch> | ((page: number) => void), entryCount: number, localStrings: LocalStrings, + c: number, } const Pagination = React.memo((props: PaginationProps) => { @@ -36,7 +37,7 @@ const Pagination = React.memo((props: PaginationProps) => {
- + {localStrings.showing} {entriesPerPage * (page - 1) + 1}-{mostEntries > entryCount ? entryCount : mostEntries} {localStrings.of} {entryCount}.
; diff --git a/src/js/components/PointBar.tsx b/src/js/components/PointBar.tsx index 6273767..d9c96f9 100644 --- a/src/js/components/PointBar.tsx +++ b/src/js/components/PointBar.tsx @@ -22,6 +22,7 @@ type PointBarProps = { localStrings: LocalStrings, entriesPerPage?: number, setEntriesPerPage?: React.Dispatch>, + totalCount?: number, } const PointBar = (props: PointBarProps) => { @@ -52,6 +53,13 @@ const PointBar = (props: PointBarProps) => { }, [page, displayPoints, entriesPerPage]); return <> + {paginatedPoints.map((point, index) => )} @@ -60,8 +68,9 @@ const PointBar = (props: PointBarProps) => { setPage={setPage} entriesPerPage={props.entriesPerPage ?? entriesPerPage} setEntriesPerPage={props.setEntriesPerPage ?? setEntriesPerPage} - entryCount={displayPoints.length} - localStrings={localStrings}/> + entryCount={props.totalCount ?? displayPoints.length} + localStrings={localStrings} + c={2}/> ; };