mirror of
https://github.com/Aviortheking/codestats-readme.git
synced 2025-07-05 21:09:19 +00:00
feat: display username in repo card (optional) (#78)
* Display username in repo card (optional) * fix: show_owner boolean flag & used nameWithOwner from gql api
This commit is contained in:
@ -7,6 +7,7 @@ const fetcher = (variables, token) => {
|
||||
query: `
|
||||
fragment RepoInfo on Repository {
|
||||
name
|
||||
nameWithOwner
|
||||
stargazers {
|
||||
totalCount
|
||||
}
|
||||
|
@ -2,9 +2,17 @@ const { kFormatter, encodeHTML, fallbackColor } = require("../src/utils");
|
||||
const icons = require("./icons");
|
||||
|
||||
const renderRepoCard = (repo, options = {}) => {
|
||||
const { name, description, primaryLanguage, stargazers, forkCount } = repo;
|
||||
const { title_color, icon_color, text_color, bg_color } = options;
|
||||
const {
|
||||
name,
|
||||
nameWithOwner,
|
||||
description,
|
||||
primaryLanguage,
|
||||
stargazers,
|
||||
forkCount,
|
||||
} = repo;
|
||||
const { title_color, icon_color, text_color, bg_color, show_owner } = options;
|
||||
|
||||
const header = show_owner ? nameWithOwner : name;
|
||||
const langName = primaryLanguage ? primaryLanguage.name : "Unspecified";
|
||||
const langColor = primaryLanguage ? primaryLanguage.color : "#333";
|
||||
|
||||
@ -36,7 +44,7 @@ const renderRepoCard = (repo, options = {}) => {
|
||||
${icons.contribs}
|
||||
</svg>
|
||||
|
||||
<text x="50" y="38" class="header">${name}</text>
|
||||
<text x="50" y="38" class="header">${header}</text>
|
||||
<text class="description" x="25" y="70">${encodeHTML(desc)}</text>
|
||||
|
||||
<g transform="translate(30, 100)">
|
||||
|
Reference in New Issue
Block a user