forked from mirrored/github-readme-stats
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3afe547077 |
@@ -304,7 +304,7 @@ You can provide multiple comma-separated values in the bg\_color option to rende
|
|||||||
* `hide_title` - *(boolean)*. Default: `false`.
|
* `hide_title` - *(boolean)*. Default: `false`.
|
||||||
* `card_width` - Set the card's width manually *(number)*. Default: `500px (approx.)`.
|
* `card_width` - Set the card's width manually *(number)*. Default: `500px (approx.)`.
|
||||||
* `hide_rank` - *(boolean)* hides the rank and automatically resizes the card width. Default: `false`.
|
* `hide_rank` - *(boolean)* hides the rank and automatically resizes the card width. Default: `false`.
|
||||||
* `rank_icon` - Shows alternative rank icon (i.e. `github`, `percentile` or `default`). Default: `default`.
|
* `rank_icon` - Shows alternative rank icon (i.e. `github`, `percentile`, `progress` or `default`). Default: `default`.
|
||||||
* `show_icons` - *(boolean)*. Default: `false`.
|
* `show_icons` - *(boolean)*. Default: `false`.
|
||||||
* `include_all_commits` - Count total commits instead of just the current year commits *(boolean)*. Default: `false`.
|
* `include_all_commits` - Count total commits instead of just the current year commits *(boolean)*. Default: `false`.
|
||||||
* `line_height` - Sets the line height between text *(number)*. Default: `25`.
|
* `line_height` - Sets the line height between text *(number)*. Default: `25`.
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
type ThemeNames = keyof typeof import("../../themes/index.js");
|
type ThemeNames = keyof typeof import("../../themes/index.js");
|
||||||
type RankIcon = "default" | "github" | "percentile";
|
type RankIcon = "default" | "github" | "percentile" | "progress";
|
||||||
|
|
||||||
export type CommonOptions = {
|
export type CommonOptions = {
|
||||||
title_color: string;
|
title_color: string;
|
||||||
|
|||||||
+7
-1
@@ -36,13 +36,19 @@ const rankIcon = (rankIcon, rankLevel, percentile) => {
|
|||||||
${percentile.toFixed(1)}%
|
${percentile.toFixed(1)}%
|
||||||
</text>
|
</text>
|
||||||
`;
|
`;
|
||||||
|
case "progress":
|
||||||
|
return `
|
||||||
|
<text x="-5" y="3" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="progress-rank-icon" class="rank-percentile-text">
|
||||||
|
${(100.0 - percentile).toFixed(1)}%
|
||||||
|
</text>
|
||||||
|
`;
|
||||||
case "default":
|
case "default":
|
||||||
default:
|
default:
|
||||||
return `
|
return `
|
||||||
<text x="-5" y="3" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="level-rank-icon">
|
<text x="-5" y="3" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="level-rank-icon">
|
||||||
${rankLevel}
|
${rankLevel}
|
||||||
</text>
|
</text>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -431,4 +431,14 @@ describe("Test renderStatsCard", () => {
|
|||||||
queryByTestId(document.body, "percentile-rank-value").textContent.trim(),
|
queryByTestId(document.body, "percentile-rank-value").textContent.trim(),
|
||||||
).toBe(stats.rank.percentile.toFixed(1) + "%");
|
).toBe(stats.rank.percentile.toFixed(1) + "%");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should show the progress", () => {
|
||||||
|
document.body.innerHTML = renderStatsCard(stats, {
|
||||||
|
rank_icon: "progress",
|
||||||
|
});
|
||||||
|
expect(queryByTestId(document.body, "rank-progress-text")).toBeDefined();
|
||||||
|
expect(
|
||||||
|
queryByTestId(document.body, "progress-rank-icon").textContent.trim(),
|
||||||
|
).toBe((100 - stats.rank.percentile).toFixed(1) + "%");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user