From 9b668f336526c7765910d6761ea0dd3af5a1a855 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 25 Aug 2018 23:45:03 +0200 Subject: [PATCH] Simplified Paginator component --- src/short-urls/Paginator.js | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/short-urls/Paginator.js b/src/short-urls/Paginator.js index 17223b9a..893e2da8 100644 --- a/src/short-urls/Paginator.js +++ b/src/short-urls/Paginator.js @@ -2,6 +2,7 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { Pagination, PaginationItem, PaginationLink } from 'reactstrap'; import PropTypes from 'prop-types'; +import { range } from 'ramda'; const propTypes = { serverId: PropTypes.string.isRequired, @@ -18,24 +19,17 @@ export default function Paginator({ paginator = {}, serverId }) { return null; } - const renderPages = () => { - const pages = []; - - for (let i = 1; i <= pagesCount; i++) { - pages.push( - - - {i} - - - ); - } - - return pages; - }; + const renderPages = () => + range(1, pagesCount + 1).map((i) => ( + + + {i} + + + )); return (