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

Implement AlphaAvatar component #2162

Merged
merged 11 commits into from
Apr 22, 2024
Merged

Conversation

yangwooseong
Copy link
Collaborator

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

  • 새로운 디자인 토큰을 활용하여 AlphaAvatar 컴포넌트를 구현합니다.

Details

  • 컴포넌트 스펙 상으로 달라지는 점은 사이즈에 16이 추가되는 것 말고는 없었기 때문에 기존의 구현을 거의 그대로 가져왔습니다. 내부적으로 사용하는 Status, useToken 는 새롭게 구현한 후에 교체할 예정입니다. 특히 useTokens 는 베지어 안에서 사용하고 있는 곳이 많지 않기 때문에, 리디자인된 토큰이 안정화되고 나서 구현해도 좋아보입니다.
  • 컴포넌트 스타일링에서 리디자인된 토큰을 사용하고 있는 곳은 없었고, 다만 opcity: 0.4에 해당하는 토큰이 필요해서 alpha 토큰에 추가했습니다.
  • useProgressiveImage 훅의 테스트 코드에서 cachedImageMap 을 사용하기 위해 훅에서 불필요하게 cachedImageMap를 인자로 받는 것을 개선했습니다. 이제 테스트 코드 안에서 Image 를 mocking해서 onLoad 를 실행하기 때문에 cachedImageMap를 받을 필요가 없어집니다. 구현은 Radix 코드를 참고했습니다 (#)

Breaking change? (Yes/No)

  • No

References

@yangwooseong yangwooseong added the feat:component Issue or PR related to a new component label Apr 17, 2024
@yangwooseong yangwooseong self-assigned this Apr 17, 2024
Copy link

changeset-bot bot commented Apr 17, 2024

🦋 Changeset detected

Latest commit: 301a2b9

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

This PR includes changesets to release 3 packages
Name Type
@channel.io/bezier-tokens Patch
@channel.io/bezier-react Patch
bezier-figma-plugin Patch

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

@channel-io channel-io deleted a comment from channeltalk bot Apr 17, 2024
Copy link
Contributor

github-actions bot commented Apr 17, 2024

Chromatic Report

🚀 Congratulations! Your build was successful!

Copy link

codecov bot commented Apr 17, 2024

Codecov Report

Attention: Patch coverage is 92.50000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 86.80%. Comparing base (281dc98) to head (301a2b9).

Files Patch % Lines
...bezier-react/src/components/AlphaAvatar/Avatar.tsx 92.00% 4 Missing ⚠️
.../src/components/AlphaAvatar/useProgressiveImage.ts 93.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main    #2162       +/-   ##
=========================================
+ Coverage      0   86.80%   +86.80%     
=========================================
  Files         0      128      +128     
  Lines         0     2735     +2735     
  Branches      0      815      +815     
=========================================
+ Hits          0     2374     +2374     
- Misses        0      356      +356     
- Partials      0        5        +5     

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

Comment on lines +26 to +27
// TODO: Replace this with useAlphaTokens
return useTokens().global.radius['radius-42-p']
Copy link
Contributor

Choose a reason for hiding this comment

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

alpha 토큰에 있을텐데 주석 적어주신대로 나중에 변경해도 될 거 같아요

export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
{
avatarUrl = '',
fallbackUrl = defaultAvatarUrl,
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

disabled={!smoothCorners}
borderRadius={AVATAR_BORDER_RADIUS}
shadow={showBorder ? shadow : undefined}
backgroundColor="bg-white-normal"
Copy link
Contributor

Choose a reason for hiding this comment

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

여기도 가능하면 사용할 수 있을텐데, 타입 정의 변경이 필요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

새로운 타입을 갖는 AlphaSmoothCornersBox를 만들어야겠네요

@channel-io channel-io deleted a comment from channeltalk bot Apr 22, 2024
Copy link

channeltalk bot commented Apr 22, 2024

@yangwooseong yangwooseong merged commit 59787c2 into channel-io:main Apr 22, 2024
11 checks passed
@yangwooseong yangwooseong deleted the web-99 branch April 22, 2024 05:01
sungik-choi pushed a commit that referenced this pull request Apr 26, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @channel.io/bezier-react@2.0.3

### Patch Changes

- Implement `AlphaAvatar` component.
([#2162](#2162)) by
@yangwooseong

- Add `AlphaAvatarGroup` component
([#2177](#2177)) by
@yangwooseong

-   Updated dependencies
    -   @channel.io/bezier-tokens@0.2.2

## @channel.io/bezier-tokens@0.2.2

### Patch Changes

- Add `opacity-disabled` to alpha token.
([#2162](#2162)) by
@yangwooseong

- Fix the value of alpha color.cobalt.300
([#2160](#2160)) by
@sungik-choi

## bezier-figma-plugin@0.5.3

### Patch Changes

-   Updated dependencies
    -   @channel.io/bezier-react@2.0.3

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
yangwooseong pushed a commit to yangwooseong/bezier-react that referenced this pull request May 2, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @channel.io/bezier-react@2.0.3

### Patch Changes

- Implement `AlphaAvatar` component.
([channel-io#2162](channel-io#2162)) by
@yangwooseong

- Add `AlphaAvatarGroup` component
([channel-io#2177](channel-io#2177)) by
@yangwooseong

-   Updated dependencies
    -   @channel.io/bezier-tokens@0.2.2

## @channel.io/bezier-tokens@0.2.2

### Patch Changes

- Add `opacity-disabled` to alpha token.
([channel-io#2162](channel-io#2162)) by
@yangwooseong

- Fix the value of alpha color.cobalt.300
([channel-io#2160](channel-io#2160)) by
@sungik-choi

## bezier-figma-plugin@0.5.3

### Patch Changes

-   Updated dependencies
    -   @channel.io/bezier-react@2.0.3

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat:component Issue or PR related to a new component
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Avatar
2 participants