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

Remove duplicate code between Issues, Commits, Repos, PullRequest #2379

Closed
Andrewnt219 opened this issue Oct 21, 2021 · 2 comments · Fixed by #2764
Closed

Remove duplicate code between Issues, Commits, Repos, PullRequest #2379

Andrewnt219 opened this issue Oct 21, 2021 · 2 comments · Fixed by #2764
Assignees
Labels
developer experience Helping the Developer Experience type: enhancement New feature or request
Milestone

Comments

@Andrewnt219
Copy link
Contributor

What would you like to be added:

As suggested in #2360. These components are quite the same, but there are still many differences in content. Therefore, we can either go with a component exposing many props or just abstract the styling and markup:

// PullRequest.tsx

<GithubResource.Container>
  <GithubResource.Title text="Pull Request" icon={<PrIcon />} />
  <GithubResouce.List>
    {prUrls.map((url) => (
      <GithubResouce.ListItem key={url}>
        <GitHubResource.Link
          href={`https://github.com${pullRequest}`}
          title={'Pull Request #' + getPullRequestNumber(pullRequest)}
          text={getPullRequestNumber(pullRequest)}
        />
      </GithubResouce.ListItem>
    ))}
  </GithubResouce.List>
</GithubResource.Container>

Why would you like this to be added:
Improve maintainability.

@Andrewnt219 Andrewnt219 added the type: enhancement New feature or request label Oct 21, 2021
@humphd
Copy link
Contributor

humphd commented Oct 21, 2021

See also #2380 which should help with this.

@HyperTHD
Copy link
Contributor

This could probably be made into a custom hook that all the components can use once everything is organized. I can help with this if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer experience Helping the Developer Experience type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants