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

Convert enum type of component props to string literal type - Toast, Tooltip, etc #1990

Merged

Conversation

yangwooseong
Copy link
Collaborator

@yangwooseong yangwooseong commented Feb 13, 2024

Self Checklist

  • I wrote a PR title in English and added an appropriate label to the PR.
  • I wrote the commit message in English and to follow the Conventional Commits specification.
  • I added the changeset about the changes that needed to be released. (or didn't have to)
  • I wrote or updated documentation related to the changes. (or didn't have to)
  • I wrote or updated tests related to the changes. (or didn't have to)
  • I tested the changes in various browsers. (or didn't have to)
    • Windows: Chrome, Edge, (Optional) Firefox
    • macOS: Chrome, Edge, Safari, (Optional) Firefox

Related Issue

Summary

Details

  • 대부분의 경우는 이전 pr과 동일하게 PascalCase 의 enum 을 kebab-case 의 string literal 타입으로 변환하는 작업입니다. 여기서 2가지 경우만 약간의 예외적인 상황이 있었습니다.
  • IconSize의 경우 IconSize.Normal = 24와 같이 size value 를 그대로 사용하던 것을 'normal' 을 받고 컴포넌트 내부에서 size 로 맵핑하는 형식으로 변경했습니다. number literal 을 그대로 받는 것보다 이렇게 하는 게 다른 컴포넌트와의 일관성이 유지된다고 생각하였습니다.
  • 한편 TextAreaHeight enum 은 TextAreaHeight.Row16 처럼 쓰이고 있어서 이를 'row16' 으로 바꾸는 것보다는 16으로 받는게 깔끔한 것 같아서 예외적으로 number literal 을 받도록 했습니다.

Breaking change? (Yes/No)

  • Yes (changeset 참고)

References

  • None

Copy link

changeset-bot bot commented Feb 13, 2024

🦋 Changeset detected

Latest commit: 297b174

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@channel.io/bezier-react Major
@channel.io/bezier-codemod Minor

Not sure what this means? Click here to learn what changesets are.

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

@yangwooseong yangwooseong added enhancement Issues or PR related to making existing features better bezier-codemod Issue or PR related to bezier-codemod labels Feb 13, 2024
Copy link
Contributor

github-actions bot commented Feb 13, 2024

Chromatic Report

🚀 Congratulations! Your build was successful!

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (09e466a) 84.04% compared to head (297b174) 83.99%.

Files Patch % Lines
...bezier-react/src/components/LegacyTooltip/utils.ts 0.00% 12 Missing ⚠️
...r-react/src/components/AvatarGroup/AvatarGroup.tsx 75.00% 1 Missing ⚠️
.../components/LegacyTooltip/LegacyTooltipContent.tsx 0.00% 1 Missing ⚠️
...es/bezier-react/src/components/Overlay/Overlay.tsx 0.00% 1 Missing ⚠️
...ages/bezier-react/src/components/Status/Status.tsx 50.00% 1 Missing ⚠️
...ezier-react/src/components/TextField/TextField.tsx 66.66% 1 Missing ⚠️
...ckages/bezier-react/src/components/Toast/Toast.tsx 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #1990      +/-   ##
==========================================
- Coverage   84.04%   83.99%   -0.06%     
==========================================
  Files         134      121      -13     
  Lines        2250     2199      -51     
  Branches      606      605       -1     
==========================================
- Hits         1891     1847      -44     
+ Misses        282      276       -6     
+ Partials       77       76       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 226 to 233
IconSize: {
XL: 'xl',
L: 'l',
Normal: 'normal',
S: 's',
XS: 'xs',
XXS: 'xxs',
XXXS: 'xxxs',
Copy link
Contributor

Choose a reason for hiding this comment

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

image

이번 기회에 피그마와 동일하게 m 으로 맞추면 좋을 거 같아요

Copy link
Contributor

Choose a reason for hiding this comment

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

utils/story path 로 검색해보면 타입스크립트 설정 등에서 이 유틸을 빌드 아티팩트에서 제외하기 위한 코드가 있을거에요. 이 부분도 함께 제거되어야할 거 같습니다.

@yangwooseong yangwooseong merged commit f765692 into channel-io:alpha Feb 13, 2024
9 of 11 checks passed
@yangwooseong yangwooseong deleted the enum-member-to-string-literal-2 branch February 13, 2024 07:49
sungik-choi added a commit that referenced this pull request Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bezier-codemod Issue or PR related to bezier-codemod enhancement Issues or PR related to making existing features better
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Writing code to convert enum props to string literal Component enum property rule proposal
2 participants