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