Skip to content

fix : Avatar 컴포넌트 리팩토링#820

Merged
grapefruit13 merged 3 commits into
githru:mainfrom
grapefruit13:fix/#818_refactor_author
Aug 9, 2025
Merged

fix : Avatar 컴포넌트 리팩토링#820
grapefruit13 merged 3 commits into
githru:mainfrom
grapefruit13:fix/#818_refactor_author

Conversation

@grapefruit13

Copy link
Copy Markdown
Contributor

Related issue

#818

Result

  1. 기존의 Author 컴포넌트에서 isUser 여부에 따라 각각 다른 컴포넌트 두 개를 렌더하는 부분을, ClickableAvatarStaticAvatar 컴포넌트로 분리하였습니다.
  2. 분리할 수 있는 객체는 constant로 분리하였습니다.

Discussion

  • 더 나은 방향으로 수정할 수 있는 부분이 있다면 편하게 리뷰 부탁드립니다!

@grapefruit13
grapefruit13 requested a review from a team as a code owner August 4, 2025 12:12
ytaek
ytaek previously approved these changes Aug 4, 2025

@ytaek ytaek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGGTM!!!

Comment on lines +1 to +12
export const AVATAR_STYLE = {
width: 30,
height: 30,
minWidth: 30,
minHeight: 30,
} as const;

export const TOOLTIP_STYLE = {
".MuiTooltip-tooltip": {
bgcolor: "#3c4048",
},
} as const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

legacy를 잘 파악하셨네요 😸


const Author = ({ name, src }: AuthorInfo) => {
const isUser = src.includes(GITHUB_URL);
const AvatarComponent = isGitHubUser(src) ? ClickableAvatar : StaticAvatar;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

component의 변수로 빼도 괜찮지만,
오히려 AvatarComponent라는 component를 밖으로 뺴는 것도 괜찮을 것 같습니다!

@grapefruit13 grapefruit13 Aug 4, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

그러네요! 굳이 컴포넌트 내 변수로 남기지 않아도 되겠네요!
이 부분도 반영해서 추가 커밋 남기겠습니다!
감사합니다👍

@grapefruit13 grapefruit13 changed the title Fix/#818 refactor author [fix] : Avatar 컴포넌트 리팩토링 Aug 5, 2025
@grapefruit13 grapefruit13 changed the title [fix] : Avatar 컴포넌트 리팩토링 fix : Avatar 컴포넌트 리팩토링 Aug 5, 2025

@ytaek ytaek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 입니다!!

@Zy0ung Zy0ung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!! 고생하셨습니다!! ✨

@SingTheCode SingTheCode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

고생하셨습니다!ㅎㅎ

import { AVATAR_STYLE, TOOLTIP_STYLE } from "./Author.const";

const isGitHubUser = (src: string): boolean => {
return src.startsWith(GITHUB_URL);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

사소한 부분이지만 의미가 더 명확하게 변경되어서 좋은 것 같습니다ㅎㅎ

@grapefruit13
grapefruit13 merged commit a559bf0 into githru:main Aug 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants