UNPKG

644 BJSXView Raw
1// @flow
2
3type InfoPropTypes = {
4 shown: number;
5 total: number;
6 one: string;
7 all: string;
8};
9
10import React from "react";
11import { numberToLocaleForm } from "x25/utility";
12
13const getNumberForm = (value : number, one : string, all : string) : string => {
14 if (value === 1) {
15 return `1 ${one}`;
16 }
17
18 return `${numberToLocaleForm(value)} ${all}`;
19};
20
21const Info = ({ shown, total, one, all } : InfoPropTypes) => (
22 <div className="text-muted">
23 {"Afișez "}
24 {
25 (shown === total) ? "tot - " : `${shown} din`
26 }
27 {` ${getNumberForm(total, one, all)}`}
28 </div>
29);
30
31export default Info;