Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update top-languages-card.js #4072

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/cards/top-languages-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const MAXIMUM_LANGS_COUNT = 20;

const NORMAL_LAYOUT_DEFAULT_LANGS_COUNT = 5;
const COMPACT_LAYOUT_DEFAULT_LANGS_COUNT = 6;
const DONUT_LAYOUT_DEFAULT_LANGS_COUNT = 5;
const DONUT_LAYOUT_DEFAULT_LANGS_COUNT = 3;
const PIE_LAYOUT_DEFAULT_LANGS_COUNT = 6;
const DONUT_VERTICAL_LAYOUT_DEFAULT_LANGS_COUNT = 6;

Expand Down Expand Up @@ -243,11 +243,11 @@ const createProgressTextNode = ({ width, color, name, progress, index }) => {
const createCompactLangNode = ({ lang, totalSize, hideProgress, index }) => {
const percentage = ((lang.size / totalSize) * 100).toFixed(2);
const staggerDelay = (index + 3) * 150;
const color = lang.color || "#858585";
const color = lang.color || "#ffffff";

return `
<g class="stagger" style="animation-delay: ${staggerDelay}ms">
<circle cx="5" cy="6" r="5" fill="${color}" />
<circle cx="5" cy="6" r="5" fill="#ffffff" />
<text data-testid="lang-name" x="15" y="10" class='lang-name'>
${lang.name} ${hideProgress ? "" : percentage + "%"}
</text>
Expand Down Expand Up @@ -618,7 +618,13 @@ const renderDonutLayout = (langs, width, totalLanguageSize) => {
const radius = centerX - 60;
const strokeWidth = 12;

const colors = langs.map((lang) => lang.color);
const langs = [
{
name: "Python",
size: 100,
color: "#FF007F",
};

const langsPercents = langs.map((lang) =>
parseFloat(((lang.size / totalLanguageSize) * 100).toFixed(2)),
);
Expand Down
Loading