mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-05-22 04:25:12 +00:00
Add loading Animation to Most used Language card (#2197)
* add: text animation * compact progress done * cleaned code * non compact animation done * tests fixed + prettier * revert: vercel.json * remove: unnecessary import * added parameter in docs * style: improve syntax Co-authored-by: rickstaa <rick.staa@outlook.com>
This commit is contained in:
committed by
GitHub
parent
227711c628
commit
77dcdab42c
@@ -10,6 +10,7 @@ import { clampValue } from "./utils.js";
|
||||
* @param {string} createProgressNodeParams.color Progress color.
|
||||
* @param {string} createProgressNodeParams.progress Progress value.
|
||||
* @param {string} createProgressNodeParams.progressBarBackgroundColor Progress bar bg color.
|
||||
* @param {number} createProgressNodeParams.delay Delay before animation starts.
|
||||
* @returns {string} Progress node.
|
||||
*/
|
||||
const createProgressNode = ({
|
||||
@@ -19,20 +20,22 @@ const createProgressNode = ({
|
||||
color,
|
||||
progress,
|
||||
progressBarBackgroundColor,
|
||||
delay,
|
||||
}) => {
|
||||
const progressPercentage = clampValue(progress, 2, 100);
|
||||
|
||||
return `
|
||||
<svg width="${width}" x="${x}" y="${y}">
|
||||
<rect rx="5" ry="5" x="0" y="0" width="${width}" height="8" fill="${progressBarBackgroundColor}"></rect>
|
||||
<rect
|
||||
height="8"
|
||||
fill="${color}"
|
||||
rx="5" ry="5" x="0" y="0"
|
||||
data-testid="lang-progress"
|
||||
width="${progressPercentage}%"
|
||||
>
|
||||
</rect>
|
||||
<svg data-testid="lang-progress" width="${progressPercentage}%">
|
||||
<rect
|
||||
height="8"
|
||||
fill="${color}"
|
||||
rx="5" ry="5" x="0" y="0"
|
||||
class="lang-progress"
|
||||
style="animation-delay: ${delay}ms;"
|
||||
/>
|
||||
</svg>
|
||||
</svg>
|
||||
`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user