mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-09-03 10:23:25 +00:00
Add format stats option (#2155)
* feat: added `format_stats` option (#2128) * refactor: change `format_stats` to `short_values` (#2128) * test: create shorten values test (#2128) * Update readme.md Co-authored-by: Rick Staa <rick.staa@outlook.com> * refactor: rename ``short_values`` to ``number_format`` * Update readme.md Co-authored-by: Rick Staa <rick.staa@outlook.com> * Update src/cards/stats-card.js Co-authored-by: Rick Staa <rick.staa@outlook.com> * refactor: format codebase --------- Co-authored-by: Rick Staa <rick.staa@outlook.com>
This commit is contained in:
co-authored by
Rick Staa
parent
b928f51442
commit
d8244a7fe5
@@ -39,8 +39,10 @@ const createTextNode = ({
|
||||
showIcons,
|
||||
shiftValuePos,
|
||||
bold,
|
||||
number_format,
|
||||
}) => {
|
||||
const kValue = kFormatter(value);
|
||||
const kValue =
|
||||
number_format.toLowerCase() === "long" ? value : kFormatter(value);
|
||||
const staggerDelay = (index + 3) * 150;
|
||||
|
||||
const labelOffset = showIcons ? `x="25"` : "";
|
||||
@@ -103,6 +105,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
|
||||
custom_title,
|
||||
border_radius,
|
||||
border_color,
|
||||
number_format = "short",
|
||||
locale,
|
||||
disable_animations = false,
|
||||
} = options;
|
||||
@@ -192,6 +195,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
|
||||
showIcons: show_icons,
|
||||
shiftValuePos: 79.01 + (isLongLocale ? 50 : 0),
|
||||
bold: text_bold,
|
||||
number_format,
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Vendored
+1
@@ -22,6 +22,7 @@ export type StatCardOptions = CommonOptions & {
|
||||
line_height: number | string;
|
||||
custom_title: string;
|
||||
disable_animations: boolean;
|
||||
number_format: string;
|
||||
};
|
||||
|
||||
export type RepoCardOptions = CommonOptions & {
|
||||
|
||||
Reference in New Issue
Block a user