1 |
|
2 |
|
3 | type InfoPropTypes = {
|
4 | shown: number;
|
5 | total: number;
|
6 | one: string;
|
7 | all: string;
|
8 | };
|
9 |
|
10 | import React from "react";
|
11 | import { numberToLocaleForm } from "x25/utility";
|
12 |
|
13 | const 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 |
|
21 | const 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 |
|
31 | export default Info;
|