Skip to content

Commit 65d4847

Browse files
rickstaaJ00MZ
authored andcommitted
Revert "Add loading Animation to Most used Language card (anuraghazra#2197)" (anuraghazra#2396)
This reverts commit 77dcdab.
1 parent f1e06fd commit 65d4847

File tree

3 files changed

+66
-85
lines changed

3 files changed

+66
-85
lines changed

readme.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,46 @@ Visit <https://indiafightscorona.giveindia.org> and make a small donation to hel
8080

8181
# Features
8282

83-
- [GitHub Stats Card](#github-stats-card)
84-
- [GitHub Extra Pins](#github-extra-pins)
85-
- [Top Languages Card](#top-languages-card)
86-
- [Wakatime Week Stats](#wakatime-week-stats)
87-
- [Themes](#themes)
88-
- [Responsive Card Theme](#responsive-card-theme)
89-
- [Customization](#customization)
90-
- [Common Options](#common-options)
91-
- [Stats Card Exclusive Options](#stats-card-exclusive-options)
92-
- [Repo Card Exclusive Options](#repo-card-exclusive-options)
93-
- [Language Card Exclusive Options](#language-card-exclusive-options)
94-
- [Wakatime Card Exclusive Option](#wakatime-card-exclusive-options)
95-
- [Deploy Yourself](#deploy-on-your-own)
96-
- [On Vercel](#on-vercel)
97-
- [On other platforms](#on-other-platforms)
98-
- [Keep your fork up to date](#keep-your-fork-up-to-date)
83+
- [Features](#features)
84+
- [GitHub Stats Card](#github-stats-card)
85+
- [Hiding individual stats](#hiding-individual-stats)
86+
- [Adding private contributions count to total commits count](#adding-private-contributions-count-to-total-commits-count)
87+
- [Showing icons](#showing-icons)
88+
- [Themes](#themes)
89+
- [All inbuilt themes](#all-inbuilt-themes)
90+
- [Responsive Card Theme](#responsive-card-theme)
91+
- [Use the transparent theme](#use-the-transparent-theme)
92+
- [Add transparent alpha channel to a themes bg\_color](#add-transparent-alpha-channel-to-a-themes-bg_color)
93+
- [Use GitHub's theme context tag](#use-githubs-theme-context-tag)
94+
- [Use GitHub's new media feature](#use-githubs-new-media-feature)
95+
- [Customization](#customization)
96+
- [Common Options](#common-options)
97+
- [Gradient in bg\_color](#gradient-in-bg_color)
98+
- [Stats Card Exclusive Options](#stats-card-exclusive-options)
99+
- [Repo Card Exclusive Options](#repo-card-exclusive-options)
100+
- [Language Card Exclusive Options](#language-card-exclusive-options)
101+
- [Wakatime Card Exclusive Options](#wakatime-card-exclusive-options)
102+
- [GitHub Extra Pins](#github-extra-pins)
103+
- [Usage](#usage)
104+
- [Demo](#demo)
105+
- [Top Languages Card](#top-languages-card)
106+
- [Usage](#usage-1)
107+
- [Exclude individual repositories](#exclude-individual-repositories)
108+
- [Hide individual languages](#hide-individual-languages)
109+
- [Show more languages](#show-more-languages)
110+
- [Compact Language Card Layout](#compact-language-card-layout)
111+
- [Hide Progress Bars](#hide-progress-bars)
112+
- [Demo](#demo-1)
113+
- [Wakatime Week Stats](#wakatime-week-stats)
114+
- [Demo](#demo-2)
115+
- [All Demos](#all-demos)
116+
- [Quick Tip (Align The Repo Cards)](#quick-tip-align-the-repo-cards)
117+
- [Deploy on your own](#deploy-on-your-own)
118+
- [On Vercel](#on-vercel)
119+
- [:film\_projector: Check Out Step By Step Video Tutorial By @codeSTACKr](#film_projector-check-out-step-by-step-video-tutorial-by-codestackr)
120+
- [On other platforms](#on-other-platforms)
121+
- [Keep your fork up to date](#keep-your-fork-up-to-date)
122+
- [:sparkling\_heart: Support the project](#sparkling_heart-support-the-project)
99123

100124
# GitHub Stats Card
101125

src/cards/top-languages-card.js

Lines changed: 18 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -39,41 +39,36 @@ const getLongestLang = (arr) =>
3939
* Creates a node to display usage of a programming language in percentage
4040
* using text and a horizontal progress bar.
4141
*
42-
* @param {object} props Function properties.
42+
* @param {object[]} props Function properties.
4343
* @param {number} props.width The card width
4444
* @param {string} props.name Name of the programming language.
4545
* @param {string} props.color Color of the programming language.
4646
* @param {string} props.progress Usage of the programming language in percentage.
47-
* @param {number} props.index Index of the programming language.
4847
* @returns {string} Programming language SVG node.
4948
*/
50-
const createProgressTextNode = ({ width, color, name, progress, index }) => {
51-
const staggerDelay = (index + 3) * 150;
49+
const createProgressTextNode = ({ width, color, name, progress }) => {
5250
const paddingRight = 95;
5351
const progressTextX = width - paddingRight + 10;
5452
const progressWidth = width - paddingRight;
5553

5654
return `
57-
<g class="stagger" style="animation-delay: ${staggerDelay}ms">
58-
<text data-testid="lang-name" x="2" y="15" class="lang-name">${name}</text>
59-
<text x="${progressTextX}" y="34" class="lang-name">${progress}%</text>
60-
${createProgressNode({
61-
x: 0,
62-
y: 25,
63-
color,
64-
width: progressWidth,
65-
progress,
66-
progressBarBackgroundColor: "#ddd",
67-
delay: staggerDelay + 300,
68-
})}
69-
</g>
55+
<text data-testid="lang-name" x="2" y="15" class="lang-name">${name}</text>
56+
<text x="${progressTextX}" y="34" class="lang-name">${progress}%</text>
57+
${createProgressNode({
58+
x: 0,
59+
y: 25,
60+
color,
61+
width: progressWidth,
62+
progress,
63+
progressBarBackgroundColor: "#ddd",
64+
})}
7065
`;
7166
};
7267

7368
/**
7469
* Creates a text only node to display usage of a programming language in percentage.
7570
*
76-
* @param {object} props Function properties.
71+
* @param {object[]} props Function properties.
7772
* @param {Lang} props.lang Programming language object.
7873
* @param {number} props.totalSize Total size of all languages.
7974
* @param {boolean} props.hideProgress Whether to hide percentage.
@@ -82,11 +77,10 @@ const createProgressTextNode = ({ width, color, name, progress, index }) => {
8277
*/
8378
const createCompactLangNode = ({ lang, totalSize, hideProgress, index }) => {
8479
const percentage = ((lang.size / totalSize) * 100).toFixed(2);
85-
const staggerDelay = (index + 3) * 150;
8680
const color = lang.color || "#858585";
8781

8882
return `
89-
<g class="stagger" style="animation-delay: ${staggerDelay}ms">
83+
<g>
9084
<circle cx="5" cy="6" r="5" fill="${color}" />
9185
<text data-testid="lang-name" x="15" y="10" class='lang-name'>
9286
${lang.name} ${hideProgress ? "" : percentage + "%"}
@@ -143,13 +137,12 @@ const createLanguageTextNode = ({ langs, totalSize, hideProgress }) => {
143137
*/
144138
const renderNormalLayout = (langs, width, totalLanguageSize) => {
145139
return flexLayout({
146-
items: langs.map((lang, index) => {
140+
items: langs.map((lang) => {
147141
return createProgressTextNode({
148-
width,
142+
width: width,
149143
name: lang.name,
150144
color: lang.color || DEFAULT_LANG_COLOR,
151145
progress: ((lang.size / totalLanguageSize) * 100).toFixed(2),
152-
index,
153146
});
154147
}),
155148
gap: 40,
@@ -294,7 +287,6 @@ const renderTopLanguages = (topLangs, options = {}) => {
294287
langs_count = DEFAULT_LANGS_COUNT,
295288
border_radius,
296289
border_color,
297-
disable_animations,
298290
} = options;
299291

300292
const i18n = new I18n({
@@ -348,43 +340,11 @@ const renderTopLanguages = (topLangs, options = {}) => {
348340
colors,
349341
});
350342

351-
if (disable_animations) card.disableAnimations();
352-
343+
card.disableAnimations();
353344
card.setHideBorder(hide_border);
354345
card.setHideTitle(hide_title);
355346
card.setCSS(
356-
`
357-
@keyframes slideInAnimation {
358-
from {
359-
width: 0;
360-
}
361-
to {
362-
width: calc(100%-100px);
363-
}
364-
}
365-
@keyframes growWidthAnimation {
366-
from {
367-
width: 0;
368-
}
369-
to {
370-
width: 100%;
371-
}
372-
}
373-
.lang-name {
374-
font: 400 11px "Segoe UI", Ubuntu, Sans-Serif;
375-
fill: ${colors.textColor};
376-
}
377-
.stagger {
378-
opacity: 0;
379-
animation: fadeInAnimation 0.3s ease-in-out forwards;
380-
}
381-
#rect-mask rect{
382-
animation: slideInAnimation 1s ease-in-out forwards;
383-
}
384-
.lang-progress{
385-
animation: growWidthAnimation 0.6s ease-in-out forwards;
386-
}
387-
`,
347+
`.lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${colors.textColor} }`,
388348
);
389349

390350
return card.render(`

src/common/createProgressNode.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { clampValue } from "./utils.js";
1010
* @param {string} createProgressNodeParams.color Progress color.
1111
* @param {string} createProgressNodeParams.progress Progress value.
1212
* @param {string} createProgressNodeParams.progressBarBackgroundColor Progress bar bg color.
13-
* @param {number} createProgressNodeParams.delay Delay before animation starts.
1413
* @returns {string} Progress node.
1514
*/
1615
const createProgressNode = ({
@@ -20,22 +19,20 @@ const createProgressNode = ({
2019
color,
2120
progress,
2221
progressBarBackgroundColor,
23-
delay,
2422
}) => {
2523
const progressPercentage = clampValue(progress, 2, 100);
2624

2725
return `
2826
<svg width="${width}" x="${x}" y="${y}">
2927
<rect rx="5" ry="5" x="0" y="0" width="${width}" height="8" fill="${progressBarBackgroundColor}"></rect>
30-
<svg data-testid="lang-progress" width="${progressPercentage}%">
31-
<rect
32-
height="8"
33-
fill="${color}"
34-
rx="5" ry="5" x="0" y="0"
35-
class="lang-progress"
36-
style="animation-delay: ${delay}ms;"
37-
/>
38-
</svg>
28+
<rect
29+
height="8"
30+
fill="${color}"
31+
rx="5" ry="5" x="0" y="0"
32+
data-testid="lang-progress"
33+
width="${progressPercentage}%"
34+
>
35+
</rect>
3936
</svg>
4037
`;
4138
};

0 commit comments

Comments
 (0)