Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita362af0

Browse files
authored
feat: add 'progress' rank icon (anuraghazra#2858)
This pull request allows users to replace the rank level with the rank progressby setting the `rank_icon` query to `progress`.
1 parent62080c0 commita362af0

File tree

8 files changed

+40
-5
lines changed

8 files changed

+40
-5
lines changed

‎package-lock.json‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎readme.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ You can provide multiple comma-separated values in the bg\_color option to rende
304304
*`hide_title` -*(boolean)*. Default:`false`.
305305
*`card_width` - Set the card's width manually*(number)*. Default:`500px (approx.)`.
306306
*`hide_rank` -*(boolean)* hides the rank and automatically resizes the card width. Default:`false`.
307-
*`rank_icon` - Shows alternative rank icon (i.e.`github` or`default`). Default:`default`.
307+
*`rank_icon` - Shows alternative rank icon (i.e.`github`,`progress` or`default`). Default:`default`.
308308
*`show_icons` -*(boolean)*. Default:`false`.
309309
*`include_all_commits` - Count total commits instead of just the current year commits*(boolean)*. Default:`false`.
310310
*`line_height` - Sets the line height between text*(number)*. Default:`25`.
@@ -553,6 +553,10 @@ Change the `?username=` value to your [Wakatime](https://wakatime.com) username.
553553

554554
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&rank_icon=github)
555555

556+
* Shows rank progress instead of rank level
557+
558+
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&rank_icon=progress)
559+
556560
* Customize Border Color
557561

558562
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&border_color=2e4058)

‎src/cards/stats-card.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ const renderStatsCard = (stats = {}, options = {}) => {
328328
<circle class="rank-circle-rim" cx="-10" cy="8" r="40" />
329329
<circle class="rank-circle" cx="-10" cy="8" r="40" />
330330
<g class="rank-text">
331-
${rankIcon(rank_icon,rank?.level)}
331+
${rankIcon(rank_icon,rank?.level,progress)}
332332
</g>
333333
</g>`;
334334

‎src/cards/types.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
typeThemeNames=keyoftypeofimport("../../themes/index.js");
2-
typeRankIcon="default"|"github";
2+
typeRankIcon="default"|"github"|"progress";
33

44
exporttypeCommonOptions={
55
title_color:string;

‎src/common/icons.js‎

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎src/getStyles.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ const getStyles = ({
9898
font: 800 24px 'Segoe UI', Ubuntu, Sans-Serif; fill:${textColor};
9999
animation: scaleInAnimation 0.3s ease-in-out forwards;
100100
}
101+
.rank-progress-text {
102+
font-size: 16px;
103+
}
101104
102105
.not_bold { font-weight: 400 }
103106
.bold { font-weight: 700 }

‎tests/__snapshots__/renderWakatimeCard.test.js.snap‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ exports[`Test Render Wakatime Card should render correctly with compact layout 1
4242
font:800 24px'Segoe UI',Ubuntu,Sans-Serif;fill: #434d58;
4343
animation:scaleInAnimation 0.3sease-in-outforwards;
4444
}
45+
.rank-progress-text{
46+
font-size: 16px;
47+
}
4548
4649
.not_bold{font-weight:400}
4750
.bold{font-weight:700}
@@ -222,6 +225,9 @@ exports[`Test Render Wakatime Card should render correctly with compact layout w
222225
font:800 24px'Segoe UI',Ubuntu,Sans-Serif;fill: #434d58;
223226
animation:scaleInAnimation 0.3sease-in-outforwards;
224227
}
228+
.rank-progress-text{
229+
font-size: 16px;
230+
}
225231
226232
.not_bold{font-weight:400}
227233
.bold{font-weight:700}

‎tests/renderStatsCard.test.js‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const stats = {
2020
totalDiscussionsStarted:10,
2121
totalDiscussionsAnswered:50,
2222
contributedTo:500,
23-
rank:{level:"A+",score:40},
23+
rank:{level:"A+",percentile:40},
2424
};
2525

2626
describe("Test renderStatsCard",()=>{
@@ -417,4 +417,14 @@ describe("Test renderStatsCard", () => {
417417
});
418418
expect(queryByTestId(document.body,"github-rank-icon")).toBeDefined();
419419
});
420+
421+
it("should show the progress",()=>{
422+
document.body.innerHTML=renderStatsCard(stats,{
423+
rank_icon:"progress",
424+
});
425+
expect(queryByTestId(document.body,"rank-progress-text")).toBeDefined();
426+
expect(
427+
queryByTestId(document.body,"progress-rank-icon").textContent.trim(),
428+
).toBe((100-stats.rank.percentile).toFixed(1)+"%");
429+
});
420430
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp