From 5e3d9da21510e1622bcf900a949c8506e4251bce Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Thu, 12 Dec 2019 21:02:20 +0530 Subject: :sparkles: Adds Paginator Component --- src/modules/dashboard/dashboard.container.js | 6 ++++ src/shared/paginator.component.js | 50 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/shared/paginator.component.js diff --git a/src/modules/dashboard/dashboard.container.js b/src/modules/dashboard/dashboard.container.js index f792c20..b8ee027 100644 --- a/src/modules/dashboard/dashboard.container.js +++ b/src/modules/dashboard/dashboard.container.js @@ -2,6 +2,7 @@ import React, { Component } from 'react'; import { connect } from "react-redux"; import WithHeaderFooter from '../../shared/header_footer.hoc'; import WithSidebar from '../../shared/sidebar.hoc'; +import Paginator from '../../shared/paginator.component'; class DashBoardContainer extends Component { render() { @@ -11,6 +12,11 @@ class DashBoardContainer extends Component {
Dashboard
+
+ +
); diff --git a/src/shared/paginator.component.js b/src/shared/paginator.component.js new file mode 100644 index 0000000..9512d4e --- /dev/null +++ b/src/shared/paginator.component.js @@ -0,0 +1,50 @@ +import React from 'react'; +import _ from 'lodash'; + +const Paginator = (props) => { + + let {totalRecords=0, currentPage=1, pageSize=15} = props; + let pages = [1]; + let previousItemStyle = totalRecordspageSize){ + pages = _.times(parseInt(totalRecords/pageSize,10)); + } + + const onPrevious = ()=>{ + props.previousPage(); + } + + const onNext = ()=>{ + props.nextPage(); + } + + const onPageClick = (pageNum)=>{ + props.goToNextPage(pageNum) + } + + + return ( + + ) +} + +export default Paginator; -- cgit v1.2.3