Use compact layout default langs count when hide_progress param was set (#2780)

This commit is contained in:
Alexandr Garbuzov authored and GitHub committed 2023-06-07 09:20:03 +02:00
1 parent f2841e09e1
commit 4044a0b666
2 files changed
+26 -11

No files matched your search

+7 -5
View File
@@ -676,11 +676,13 @@ const noLanguagesDataNode = ({ color, text, layout }) => {
/**
* Get default languages count for provided card layout.
*
* @param {import("./types").TopLangOptions["layout"] | undefined} layout Input layout string
* @return {number} Default languages count for input layout
* @param {object} props Function properties.
* @param {import("./types").TopLangOptions["layout"]=} props.layout Input layout string.
* @param {boolean=} props.hide_progress Input hide_progress parameter value.
* @return {number} Default languages count for input layout.
*/
const getDefaultLanguagesCountByLayout = (layout) => {
if (layout === "compact") {
const getDefaultLanguagesCountByLayout = ({ layout, hide_progress }) => {
if (layout === "compact" || hide_progress === true) {
return COMPACT_LAYOUT_DEFAULT_LANGS_COUNT;
} else if (layout === "donut") {
return DONUT_LAYOUT_DEFAULT_LANGS_COUNT;
@@ -714,7 +716,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
layout,
custom_title,
locale,
langs_count = getDefaultLanguagesCountByLayout(layout),
langs_count = getDefaultLanguagesCountByLayout({ layout, hide_progress }),
border_radius,
border_color,
disable_animations,