Skip to content

Commit

Permalink
fix(github/repo): fix issue with longer repo names
Browse files Browse the repository at this point in the history
  • Loading branch information
punctuations committed Jul 21, 2021
1 parent 62669aa commit aed0a14
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions lib/assets/github/repo/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,16 @@ export const RepoImage = async (
font-family='"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'
>
${
!repo ? null : `${escapeUnsafe(repo?.full_name.split("/")[0])}/`
!repo ? null : `${escapeUnsafe(repo?.full_name.split("/")[0])} /`
}<tspan font-weight="bold">
${
!repo
? null
: repo?.full_name.length >= 27
? ` ${escapeUnsafe(
repo?.full_name
.split("/")[1]
.substring(
0,
repo?.full_name.split("/")[0].length -
repo?.full_name.split("/")[1].length
)
)}`
: ` ${escapeUnsafe(repo?.full_name.split("/")[1])}`
: repo?.full_name.length > 26
? `${escapeUnsafe(
repo?.full_name.substring(0, 26).split("/")[1]
)}...`
: `${escapeUnsafe(repo?.full_name.split("/")[1])}`
}
</tspan>
</text>
Expand Down Expand Up @@ -131,7 +125,7 @@ export const RepoImage = async (
${
!repo
? null
: escapeUnsafe(repo.description.substring(0, 72))
: escapeUnsafe(repo.description.substring(0, 68))
}
</text>
<text
Expand All @@ -152,9 +146,9 @@ export const RepoImage = async (
? null
: repo.description.length >= 154
? `${escapeUnsafe(
repo.description.substring(72, 154)
repo.description.substring(68, 154)
)}...`
: escapeUnsafe(repo.description.substring(72))
: escapeUnsafe(repo.description.substring(68))
}
</text>
`
Expand Down

1 comment on commit aed0a14

@vercel
Copy link

@vercel vercel bot commented on aed0a14 Jul 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.