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

fix: Fix Card Click Behavior for Pinned Repos and Gists #3955 #3961

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
15 changes: 8 additions & 7 deletions src/cards/gist-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,16 @@ const renderGistCard = (gistData, options = {}) => {
`);
card.setHideBorder(hide_border);

return card.render(`
<text class="description" x="25" y="-5">
return ` <a href="https://github.com/${nameWithOwner}" target="_blank" rel="noopener noreferrer">
${card.render(`
<text class="description" x="25" y="-5">
${descriptionSvg}
</text>

<g transform="translate(30, ${height - 75})">
</text>
<g transform="translate(30, ${height - 75})">
${starAndForkCount}
</g>
`);
</g>
`)}
</a>`;
};

export { renderGistCard, HEADER_MAX_LENGTH };
Expand Down
43 changes: 24 additions & 19 deletions src/cards/repo-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,25 +169,30 @@ const renderRepoCard = (repo, options = {}) => {
.badge rect { opacity: 0.2 }
`);

return card.render(`
${
isTemplate
? // @ts-ignore
getBadgeSVG(i18n.t("repocard.template"), colors.textColor)
: isArchived
? // @ts-ignore
getBadgeSVG(i18n.t("repocard.archived"), colors.textColor)
: ""
}

<text class="description" x="25" y="-5">
${descriptionSvg}
</text>

<g transform="translate(30, ${height - 75})">
${starAndForkCount}
</g>
`);
// by wrapping card.render into <a> tag - Incorrect formatting of repo card description Fixes
return `
<a href="https://github.com/${nameWithOwner}" target="_blank" rel="noopener noreferrer">
${card.render(`
${
isTemplate
? // @ts-ignore
getBadgeSVG(i18n.t("repocard.template"), colors.textColor)
: isArchived
? // @ts-ignore
getBadgeSVG(i18n.t("repocard.archived"), colors.textColor)
: ""
}

<text class="description" x="25" y="-5">
${descriptionSvg}
</text>

<g transform="translate(30, ${height - 75})">
${starAndForkCount}
</g>
`)}
</a>
`;
};

export { renderRepoCard };
Expand Down