diff --git a/api/pin.js b/api/pin.js index 7323bc54..82c3322c 100644 --- a/api/pin.js +++ b/api/pin.js @@ -19,6 +19,7 @@ export default async (req, res) => { icon_color, text_color, bg_color, + card_width, theme, show_owner, show, @@ -115,6 +116,7 @@ export default async (req, res) => { theme, border_radius, border_color, + card_width: parseInt(card_width, 10), show_owner: parseBoolean(show_owner), show: showStats, show_icons: parseBoolean(show_icons), diff --git a/src/cards/repo-card.js b/src/cards/repo-card.js index 9fc36422..3b10ce2d 100644 --- a/src/cards/repo-card.js +++ b/src/cards/repo-card.js @@ -78,6 +78,7 @@ const renderRepoCard = (repo, options = {}) => { icon_color, text_color, bg_color, + card_width = 400, show_owner = false, show = [], show_icons = true, @@ -175,7 +176,7 @@ const renderRepoCard = (repo, options = {}) => { const desc = parseEmojis(description || "No description provided"); const multiLineDescription = wrapTextMultiline( desc, - DESCRIPTION_LINE_WIDTH, + Math.round((card_width - 400) / 5.93 + DESCRIPTION_LINE_WIDTH), descriptionMaxLines, ); const descriptionLinesCount = description_lines_count @@ -246,7 +247,7 @@ const renderRepoCard = (repo, options = {}) => { const card = new Card({ defaultTitle: header.length > 35 ? `${header.slice(0, 35)}...` : header, titlePrefixIcon: icons.contribs, - width: 400, + width: card_width, height, border_radius, colors,