Skip to content

Conversation

@rtttr1
Copy link

@rtttr1 rtttr1 commented Oct 3, 2025

변경사항

  • icon을 카테고리별로 묶어서 import 할 수 있게 해주었습니다.
  • icon story 파일에서 묶어서 import 한 icon들을 map을 활용하여 story가 생성되게 해주었습니다.
    이로인해 아이콘을 자동추출해주면 스토리북에 알아서 추출된 아이콘까지 포함됩니다.

링크

시급한 정도

🏃‍♂️ 보통 : 최대한 빠르게 리뷰 부탁드립니다.

기타 사항

@rtttr1 rtttr1 self-assigned this Oct 3, 2025
@height
Copy link

height bot commented Oct 3, 2025

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@changeset-bot
Copy link

changeset-bot bot commented Oct 3, 2025

⚠️ No Changeset found

Latest commit: 35ae5a3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rtttr1 rtttr1 changed the title feature(icon): icon story 파일 하드코딩 방식에서 map활용 랜더링 방식으로 변경 feature(icons): icon story 파일 하드코딩 방식에서 map활용 랜더링 방식으로 변경 Oct 3, 2025
Copy link

@constantly-dev constantly-dev left a comment

Choose a reason for hiding this comment

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

수고하셨습니다! 몇 개 리뷰만 확인해주세요!

} from '@sopt-makers/icons';

const convertIconNameToKebabCase = (iconName: string): string => {
const withoutIcon = iconName.replace(/^Icon/, '');

Choose a reason for hiding this comment

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

사소하지만 withoutIconPrefix로 네이밍하는 것은 어떨까요?

Comment on lines +62 to +64
{Object.values(category.icons).map((icon, index) => (
<IconGenerator icon={icon} style={style} key={`${category.name}-${index}`} />
))}

Choose a reason for hiding this comment

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

여기를 Object.values가 아니라 Object.entries를 쓰면 여기서 컴포넌트 이름도 받을 수 있을 것 같아요.
그 컴포넌트 이름을 IconGenerator에 넘겨주면 아래 로직도 안써도 되고

const iconName = convertIconNameToKebabCase(icon.__docgenInfo.displayName);

any type도 안써도 될 것 같아요.

Suggested change
{Object.values(category.icons).map((icon, index) => (
<IconGenerator icon={icon} style={style} key={`${category.name}-${index}`} />
))}
{Object.entries(category.icons).map(([iconName, IconComponent]) => (
<IconGenerator key={iconName} icon={IconComponent} name={iconName} style={style} />
))}

또한 __docgenInfo 자체도 코드로 직접 작성하는 것보다 storybook이 내부적으로 docs를 위해서 사용하는 값 같아서 이게 실제 배포환경이나 빌드 됐을때 문제가 없을지 조금 걱정이 되기도 합니다.
(이 부분은 저도 지식이 부족해 아는 게 있으시다면 알려주세요!)

Comment on lines +43 to +56
// icon 카테고리 추가시 이곳에 추가
const iconCategories = [
{ name: 'Communication', icons: Communication },
{ name: 'Editor', icons: Editor },
{ name: 'Feedback', icons: Feedback },
{ name: 'Files', icons: Files },
{ name: 'General', icons: General },
{ name: 'Interaction', icons: Interaction },
{ name: 'Media', icons: Media },
{ name: 'Time', icons: Time },
{ name: 'Users', icons: Users },
{ name: 'Logo', icons: Logo },
];

Choose a reason for hiding this comment

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

위치가 여기있으면 render될 때마다 변수가 다시 선언될 것 같아요. iconCategoriesrender 외부로 빼도 될 것 같습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants