-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add GitHub components for Repos, Issues, PullRequests #2367
Conversation
How do I fix this? Screen.Recording.2021-10-18.at.6.19.30.PM.mov |
I can't see what you're talking about |
@Andrewnt219, can you review this too please? |
The github info goes over the title and date when I scroll to the bottom of the post. |
Also I just realized I swapped the icons for Repos and Pull Requests 😬 Fixed now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm loving this. A few things I notice on first read.
I noticed this too. One question I had: should we only show the repo name and not the owner? So |
Add title attrbute to Issues and PRs Simplify regex to get Issue/PR number
Add title attrbute to Repo: "user/repo" Remove user from repo name displayed
I tried this and it looks better in my opinion. You can check the last deployment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some more feedback. Feel free to break the work up a bit, and file follow-up issues that we can work on vs. feeling like we have to get this perfect before we can merge. I'd be happy to take it as-is once we get the last few edges sanded down.
I filed #2370, #2371, #2372, and #2373 for follow-up. @menghif, @Andrewnt219: anything else we're not going to do in this PR, please file as new issues that we can work on later once this goes in. The fixes above based on @DukeManh's review could happen here I think, plus any other code changes based on subsequent reviews. |
@HyperTHD I can't reproduce, Is it a |
I suspect that is the issue. Unless I'm mistaken, this code should be the issue causing this. |
Use h2 instead of h1 for Repo, Issue and PR title. Wrap extractGitHubUrlsFromPost into react's useMemo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really close, a few more things.
); | ||
|
||
const getUserName = (repo: string) => { | ||
return repo.replace(/\/([^\/]+).*/, '$1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of { return
, you don't need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got rid of the function all together since we don't need it for now.
{repoUrls.map((repo) => ( | ||
<p key={repo} className={classes.repo}> | ||
<a | ||
href={`https://github.com${repo}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the repo have a leading /
or not? In line 57 you assume it does, but in line 60 you assume it doesn't. We need to be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest it should not have a /
at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the leading /
and made the appropriate changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@humphd @menghif to be consistent, best to keep the leading slash in repo URLs. URL.pathname
returns a string with a leading slash, so issues, commits, pull requests all have a leading slash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed in #2374 if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it. Can't wait to start using this!
Filed #2380 to do a bit of reorg on these files later on. |
This needs a rebase, but since it's got two authors, I'll do it for you and merge. |
Rebased and merged in bce0b21. Great job everyone! |
Issue This PR Addresses
Fixes #2360
Type of Change
Description
This PR adds a way to display links for all GitHub repos, issues and pull requests that are linked throughout a post. This information is displayed on the right sidebar underneath the blog post's date for easy visibility.
If there is no repo URL in the post, but there is at least one issue or PR, the repo URL will be taken from that issue or PR.
Screenshots:
Checklist