-
Notifications
You must be signed in to change notification settings - Fork 105
refactor(view): processMessage 함수 내 GIthubIssueLink 컴포넌트 분리 #921
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| @import "styles/app"; | ||
|
|
||
| .commit-message__issue-link { | ||
| color: var(--color-primary); | ||
| text-decoration: none; | ||
| font-weight: 500; | ||
| padding: 0.125rem 0.25rem; | ||
| border-radius: 0.125rem; | ||
| background-color: rgba(224, 96, 145, 0.1); | ||
| transition: all 0.2s ease-in-out; | ||
|
|
||
| &:hover { | ||
| background-color: rgba(224, 96, 145, 0.2); | ||
| text-decoration: underline; | ||
| transform: translateY(-1px); | ||
| } | ||
|
|
||
| &:active { | ||
| transform: translateY(0); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import cn from "classnames"; | ||
|
|
||
| import type { GithubIssueLinkProps } from "./GithubIssueLink.type"; | ||
| import "./GithubIssueLink.scss"; | ||
|
|
||
| const GithubIssueLink = ({ owner, repo, issueNumber, className, ...rest }: GithubIssueLinkProps) => { | ||
| const issueLink = `https://github.com/${owner}/${repo}/issues/${issueNumber}`; | ||
|
|
||
| return ( | ||
| <a | ||
| href={issueLink} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className={cn("commit-message__issue-link", className)} | ||
| title={`GitHub Issue #${issueNumber}`} | ||
| {...rest} | ||
| > | ||
| #{issueNumber} | ||
| </a> | ||
| ); | ||
| }; | ||
|
|
||
| export default GithubIssueLink; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import type { ComponentPropsWithoutRef } from "react"; | ||
|
|
||
| export interface GithubIssueLinkProps | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오오!! 고급 type 활용편인가요!!! 👍👍👍
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 공통 컴포넌트로 추출하다보니 지금 사용하고 있는 두 컴포넌트 이외에도 추후에 다른 곳에서 사용될 수 있을 것 같아서 |
||
| extends Omit<ComponentPropsWithoutRef<"a">, "href" | "target" | "rel" | "children"> { | ||
| owner: string; | ||
| repo: string; | ||
| issueNumber: string; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default as GithubIssueLink } from "./GithubIssueLink"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,9 @@ import { | |
| } from "@mui/icons-material"; | ||
| import { Tooltip } from "@mui/material"; | ||
|
|
||
| import { Author } from "components/@common/Author"; | ||
| import { useGithubInfo, useDataStore } from "store"; | ||
| import { Author } from "components/@common/Author"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (취향, 개취), common 폴더 앞에 @골뱅이도 나중에 없애면 좋긴 하겠습니다. 이전에 common이 상단에 오는게 좋다면서 @를 붙이자고 하셨는데, 여전히 개인적으로는 뭔가 거슬리네요 😈😈😈😈😈
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 왜 해당 폴더만 @가 붙어있는지 궁금했었는데 그런 히스토리가 있었군요..! 단순히 @만 제거하고
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@nxnaxx 님, 요 부분 issue로 discussion label 달고 만드시면 어떨까요?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네 이슈로 올려보겠습니다😄 |
||
| import { GithubIssueLink } from "components/@common/GithubIssueLink"; | ||
|
|
||
| import { useCommitListHide } from "./Detail.hook"; | ||
| import { getCommitListDetail } from "./Detail.util"; | ||
|
|
@@ -57,21 +58,15 @@ const Detail = ({ clusterId, authSrcMap }: DetailProps) => { | |
| parts.push(message.slice(lastIndex, match.index)); | ||
| } | ||
|
|
||
| // 이슈 번호를 링크로 변환 | ||
| const issueNumber = match[1].substring(1); // # 제거 | ||
| const issueLink = `https://github.com/${owner}/${repo}/issues/${issueNumber}`; | ||
| const issueNumber = match[1].substring(1); | ||
|
|
||
| parts.push( | ||
| <a | ||
| <GithubIssueLink | ||
| key={`issue-${issueNumber}-${match.index}`} | ||
| href={issueLink} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="commit-message__issue-link" | ||
| title={`GitHub Issue #${issueNumber}`} | ||
| > | ||
| {match[1]} | ||
| </a> | ||
| owner={owner} | ||
| repo={repo} | ||
| issueNumber={issueNumber} | ||
| /> | ||
| ); | ||
|
|
||
| lastIndex = match.index + match[0].length; | ||
|
|
||
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.
의견입니다ㅎㅎ
이제 이름이 생겼으니 스타일에서도 .github-issue-link 이런 느낌으로 쓰는거 어떨까요
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.
의견 감사합니다!!
분리에만 집중하다보니 놓쳤네요. 저도 컴포넌트명이랑 통일시키는 게 좋은 것 같습니다 ㅎㅎ 다음 작업 때 반영해 보겠습니다😄