refactor: added reusable Card class to reduce code & test duplication (#260)

* refactor: added reusable Card class to reduce code & test duplication

* fix: top-langs card width & documented card_width option
This commit is contained in:
Anurag Hazra
2020-07-30 19:19:03 +05:30
committed by GitHub
parent 34b5dcb181
commit 3b0f1b11a0
10 changed files with 425 additions and 221 deletions

View File

@ -14,13 +14,14 @@ module.exports = async (req, res) => {
username,
hide,
hide_title,
hide_border,
card_width,
title_color,
text_color,
bg_color,
theme,
cache_seconds,
layout
layout,
} = req.query;
let topLangs;
@ -42,15 +43,15 @@ module.exports = async (req, res) => {
res.send(
renderTopLanguages(topLangs, {
theme,
hide_title: parseBoolean(hide_title),
hide_border: parseBoolean(hide_border),
card_width: parseInt(card_width, 10),
hide: parseArray(hide),
title_color,
text_color,
bg_color,
theme,
layout
layout,
})
);
};