-
Notifications
You must be signed in to change notification settings - Fork 1
PrezelImage 구현 #45
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
PrezelImage 구현 #45
Conversation
디자인시스템에 다양한 이미지 소스(URL, Drawable)를 처리할 수 있는 `PrezelImage` 컴포넌트를 추가했습니다. * `PrezelImageSource` sealed interface를 통해 이미지 소스 타입 정의 (Url, Drawable) * `rounded`, `border` 옵션을 통한 이미지 스타일 커스텀 기능 지원 * `PrezelAsyncImage`를 사용한 네트워크 이미지 로딩 및 Drawable 리소스 표시 대응 * 컴포넌트 동작 확인을 위한 Preview 코드 추가
아이콘 리소스 파일명에 `core_designsystem_` 접두사를 추가하고 관련 코드를 수정했습니다. * `res/drawable` 내 모든 아이콘 파일명 변경 (예: `ic_arrow_left` -> `core_designsystem_ic_arrow_left`) * `PrezelIcons.kt` 내 리소스 참조 경로 업데이트 * `PrezelAvatar.kt` 내 하드코딩된 리소스 참조 수정 * `PrezelImage.kt`, `PrezelImageSource.kt` 내 불필요한 개행 제거
* `PrezelImage` 내부 `Modifier`의 가독성 개선을 위해 줄바꿈을 추가했습니다. * `LaunchedEffect`의 key를 `Unit`에서 `source`로 변경하여 이미지 소스 변경 시 `onSuccess` 콜백이 적절히 재실행되도록 수정했습니다.
Walkthrough디자인 시스템의 드로어블 참조명을 Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/image/PrezelImage.kt`:
- Line 97: The preview label "Drawable / No Round / No Border" is inconsistent
with the PrezelImage call that sets rounded = true; update the Text label in
PrezelImage.kt to reflect the actual configuration (e.g., "Drawable / Rounded /
No Border") or change the PrezelImage parameter (rounded) to false so the label
matches—locate the Text(...) and the PrezelImage(...) usage to keep the
description and the rounded property in sync.
🧹 Nitpick comments (2)
Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/image/PrezelImageSource.kt (1)
12-15:@DrawableRes어노테이션 추가를 권장합니다.기존
DrawableIcon클래스(IconSource.kt, line 21)와 일관성을 유지하고, 컴파일 타임에 올바른 리소스 타입이 전달되는지 검증하기 위해@DrawableRes어노테이션을 추가하는 것이 좋습니다.♻️ 제안하는 수정
+import androidx.annotation.DrawableRes + `@Immutable` data class Drawable( - val resId: Int, + `@DrawableRes` val resId: Int, ) : PrezelImageSourcePrezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/image/PrezelImage.kt (1)
44-44: 컨테이너 크기를 외부에서 설정 가능하게 만드는 것을 권장합니다.PR 설명에서 언급된 것처럼, 고정된 100.dp 크기는 재사용성을 제한합니다.
size: Dp = 100.dp파라미터를 추가하면 다양한 사용 케이스를 지원할 수 있습니다.♻️ 제안하는 수정
`@Composable` fun PrezelImage( source: PrezelImageSource, contentDescription: String, modifier: Modifier = Modifier, + size: Dp = 100.dp, rounded: Boolean = false, border: Boolean = false, onSuccess: () -> Unit = {}, onError: (Throwable?) -> Unit = {}, ) { // ... Box( modifier = modifier - .size(100.dp) + .size(size) .clip(shape)
.../designsystem/src/main/java/com/team/prezel/core/designsystem/component/image/PrezelImage.kt
Outdated
Show resolved
Hide resolved
`PrezelImage` 컴포넌트 내부에 하드코딩되어 있던 `100.dp` 크기 설정을 제거하고, 외부에서 전달받은 `modifier`를 통해 크기를 결정하도록 수정했습니다. 또한 미리보기(Preview) 코드를 보완했습니다. * `PrezelImage` 내부 `Box` 및 `Image`의 고정 크기 제거 * Preview에서 각 케이스별로 `Modifier.size(100.dp)` 명시적 추가 * Preview 내 누락된 테두리(Border) 테스트 케이스 추가 및 텍스트 수정
PrezelImage의 프리뷰 코드에서 반복되는 부분을 별도의 컴포저블 함수인 `PrezelImagePreviewItem`으로 분리하여 가독성을 높였습니다.
`PrezelImageSource`를 사용하는 방식 대신 URL과 Drawable 리소스를 각각 처리하는 오버로딩 함수로 분리했습니다. 또한 공통 스타일 로직을 `prezelImageContainer` 확장 함수로 추출하여 코드 중복을 제거했습니다. * `PrezelImageSource` 기반의 조건부 렌더링 제거 * URL 입력을 받는 `PrezelImage`와 Drawable 리소스를 받는 `PrezelImage`로 분리 * 공통 스타일(shape, border) 처리를 위한 `prezelImageContainer` Modifier 추가 * 불필요한 `LaunchedEffect` 제거 및 import 정리
📌 작업 내용
오버로딩으로 Url인 Image와 Drawable인 Image를 구분했습니다.
🧩 관련 이슈
📸 스크린샷
📢 논의하고 싶은 내용
Summary by CodeRabbit
새로운 기능
스타일
✏️ Tip: You can customize this high-level summary in your review settings.