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

Added card_width argument to gist card #3405

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/gist.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default async (req, res) => {
border_color,
show_owner,
hide_border,
card_width,
} = req.query;

res.setHeader("Content-Type", "image/svg+xml");
Expand Down Expand Up @@ -74,6 +75,7 @@ export default async (req, res) => {
locale: locale ? locale.toLowerCase() : null,
show_owner: parseBoolean(show_owner),
hide_border: parseBoolean(hide_border),
card_width: parseInt(card_width),
}),
);
} catch (err) {
Expand Down
3 changes: 2 additions & 1 deletion src/cards/gist-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const renderGistCard = (gistData, options = {}) => {
border_color,
show_owner = false,
hide_border = false,
card_width,
} = options;

// returns theme based colors with proper overrides and defaults
Expand Down Expand Up @@ -118,7 +119,7 @@ const renderGistCard = (gistData, options = {}) => {
? `${header.slice(0, HEADER_MAX_LENGTH)}...`
: header,
titlePrefixIcon: icons.gist,
width: CARD_DEFAULT_WIDTH,
width: card_width ? card_width : CARD_DEFAULT_WIDTH,
yaten2302 marked this conversation as resolved.
Show resolved Hide resolved
height,
border_radius,
colors: {
Expand Down