MCPcopy Create free account
hub / github.com/alephdata/aleph / render

Method render

ui/src/react-ftm/types/Numeric.tsx:20–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18 );
19 }
20 render() {
21 const { num, abbr = false, animate = false } = this.props;
22
23 if (num === undefined) {
24 return null;
25 }
26
27 let content;
28 if (abbr) {
29 content = numeral(num).format('0a');
30 if (animate) {
31 const match = content.match(/(?<val>[0-9]+)(?<suffix>[a-z]?)/);
32 if (match?.groups) {
33 const { val, suffix } = match.groups;
34 content = (
35 <>
36 {this.renderAnimated(+val)}
37 {suffix}
38 </>
39 );
40 }
41 }
42 } else {
43 content = animate ? (
44 this.renderAnimated(num)
45 ) : (
46 <FormattedNumber value={num} />
47 );
48 }
49
50 return <span className="Numeric">{content}</span>;
51 }
52}
53
54export default injectIntl(Numeric);

Callers

nothing calls this directly

Calls 2

renderAnimatedMethod · 0.95
matchMethod · 0.45

Tested by

no test coverage detected