Skip to content

Conversation

@HamBeomJoon
Copy link
Contributor

@HamBeomJoon HamBeomJoon commented Jan 28, 2026

📌 작업 내용

PrezelSnackBar 컴포넌트 구현

  • PrezelSnackBarAction == null이면 Toast처럼 사용, null이 아니면 Snackbar처럼 사용

🧩 관련 이슈


📸 스크린샷

스크린샷 2026-01-30 12 57 36




Screenshot_1769697836
Screenshot_1769697840
Screenshot_1769697845
Screenshot_1769697848

Summary by CodeRabbit

  • 새로운 기능
    • 디자인 시스템에 공개 스낵바 컴포넌트(PrezelSnackbar) 추가.
    • 선행 아이콘, 메시지, 선택적 액션 버튼 및 맞춤형 테마 지원.
    • SnackbarHostState에서 간편히 호출해 메시지 표시 가능(액션/해제 콜백 및 지속시간 옵션 포함).
    • 전역 호스트(PrezelSnackbarHost)와 테마 기반 미리보기로 다양한 조합 확인 가능.

✏️ Tip: You can customize this high-level summary in your review settings.

디자인시스템에 커스텀 스낵바 컴포넌트인 `PrezelSnackBar`를 추가했습니다.

*   `PrezelSnackBar` 및 스타일 정의 (`PrezelSnackBarStyle`)
*   아이콘 및 액션 버튼(Action Label) 지원
*   미리보기를 위한 Preview 코드 추가
PrezelSnackBar.kt 내 Preview 관련 코드의 가독성을 위해 파라미터 줄바꿈을 적용하고 불필요한 공백을 제거했습니다.
@HamBeomJoon HamBeomJoon self-assigned this Jan 28, 2026
@HamBeomJoon HamBeomJoon added the ✨ feat 새로운 기능 추가 또는 기존 기능 확장 label Jan 28, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Walkthrough

디자인시스템에 스낵바 구현이 추가되었습니다. `PrezelSnackbar.kt`에 공개 컴포저블 `PrezelSnackbar(data: SnackbarData, modifier: Modifier = Modifier)`와 선택적 선행 아이콘 렌더링용 확장 및 프리뷰 전용 타입/컴포저블들이 추가되었습니다. `SnackbarHost.kt`에는 내부 데이터 클래스 `PrezelSnackbarVisuals(...)`(SnackbarVisuals 구현), `suspend fun SnackbarHostState.showPrezelSnackbar(...)` 확장 함수, 그리고 `@Composable fun PrezelSnackbarHost(hostState: SnackbarHostState, modifier: Modifier = Modifier)`가 추가되어 시각 요소 전달과 스낵바 표시 흐름을 제공하도록 변경되었습니다.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 'PrezelSnackBar 구현'으로 명확하게 주요 변경사항인 PrezelSnackBar 컴포넌트 구현을 요약하고 있습니다.
Description check ✅ Passed PR 설명이 작업 내용, 관련 이슈, 스크린샷을 포함하여 템플릿의 주요 섹션을 충족하고 있습니다.
Linked Issues check ✅ Passed 추가된 코드가 #33 이슈의 요구사항을 충족합니다: PrezelSnackbar 컴포넌트 구현, 액션 유무로 Toast/Snackbar 동작 전환, 선택적 아이콘 지원, 테마 적용.
Out of Scope Changes check ✅ Passed 모든 변경사항이 #33 이슈의 PrezelSnackbar 컴포넌트 구현에 직접 관련되어 있으며, 범위를 벗어난 변경이 없습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/PrezelSnackBar.kt`:
- Around line 97-105: Add an explicit maxLines to the Text in PrezelSnackBar so
TextOverflow.Ellipsis actually truncates; update the Text composable (in
PrezelSnackBar.kt) to set maxLines based on the snack bar's intended line count
(e.g., use an existing lineCount/variant if present, otherwise default to 1 or 2
per the PR decision), ensuring the Text(...) call includes maxLines =
<chosenValue> to enforce ellipsis.

기존 `PrezelSnackBarPreview`를 `PrezelSnackBarAllPreview`로 변경하고, 스낵바와 토스트 프리뷰를 각각 `PrezelSnackbarPreview`와 `PrezelToastPreview`로 분리하여 추가했습니다.
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/PrezelSnackBar.kt`:
- Around line 64-68: The Snackbar currently hardcodes dark palette colors (e.g.,
color = PrezelColorScheme.Dark.bgMedium) which breaks light theme; replace
direct PrezelColorScheme.Dark.* usages with the theme-aware color provider
(PrezelTheme.colors or LocalPrezelColors) so the Surface and any background/text
colors in PrezelSnackBar react to theme changes; locate the Surface and other
occurrences in PrezelSnackBar (the color assignments at the shown blocks and the
additional occurrences around the other noted spots) and swap each
PrezelColorScheme.Dark.<...> reference to the corresponding value from
PrezelTheme.colors (or LocalPrezelColors) while keeping existing shape/style
references like style.shape unchanged.

Copy link
Member

@moondev03 moondev03 left a comment

Choose a reason for hiding this comment

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

👍

message: String,
modifier: Modifier = Modifier,
leadingIcon: IconSource? = null,
action: PrezelSnackBarAction? = null,
Copy link
Member

@moondev03 moondev03 Jan 29, 2026

Choose a reason for hiding this comment

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

스낵바의 Action은 SnackbarData에 포함되어 있어요
PrezelSnackBarAction의 onClick()은 snackbarHostState.showSnackbar()의 반환 값인 SnackbarResult로 처리 가능해요

기존 `PrezelSnackBar.kt`를 `snackbar/PrezelSnackbar.kt`로 이동 및 구조를 변경하고, `SnackbarHostState`와 연동 가능한 컴포넌트들을 추가했습니다.

*   `PrezelSnackbar`: `SnackbarData`를 직접 받도록 변경하고 `PrezelSnackbarDefaults` 객체를 통해 스타일 상수를 관리하도록 수정
*   `PrezelSnackbarHost`: Material3 `SnackbarHost`를 기반으로 하는 커스텀 스낵바 호스트 추가
*   `showPrezelSnackbar`: `leadingIcon`을 포함할 수 있는 `SnackbarHostState` 확장 함수 추가
*   `PrezelSnackbarVisuals`: 커스텀 아이콘 지원을 위한 `SnackbarVisuals` 인터페이스 구현체 추가
*   기타: 파일 경로 이동 및 미리보기(Preview) 코드 최신화 (Ellipsis 제거 및 최소 높이 설정 등)
ktlint 적용에 따른 코드 스타일 변경 사항을 반영합니다.

* 불필요한 공백 제거
* `previewData` 함수 반환값 줄바꿈 수정
* `PreviewSnackbarData` 클래스 내 메서드 간 공백 추가
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In
`@Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/snackbar/PrezelSnackbar.kt`:
- Around line 192-197: KtLint reports a missing blank line before the dismiss()
declaration in the PreviewSnackbarData class; open the PreviewSnackbarData class
(which implements SnackbarData) and insert a single empty line between the
performAction() implementation and the override fun dismiss() declaration so
there is a blank line separating performAction() and dismiss() within the class.
- Line 59: Remove the extra consecutive blank lines in PrezelSnackbar.kt so
there are no unnecessary empty lines (collapse multiple blank lines into a
single blank line) around the PrezelSnackbar declaration or its related
functions/companion/object; locate the PrezelSnackbar class or any
function/companion block in that file and ensure there is at most one blank line
between declarations and inside the class body.
- Around line 174-183: 함수 previewData의 expression body 앞에 줄바꿈이 없어 KtLint 오류가
발생하므로 previewData(…) 선언과 '=' 사이에 줄바꿈을 추가하거나 expression body를 블록 바디로 변경하여 포맷을
맞추세요; 대상 심볼: previewData, PreviewSnackbarData, PreviewSnackbarVisuals — 즉
previewData 함수 서명 끝에 줄바꿈을 넣고 그 다음 줄에서 '='로 시작해 PreviewSnackbarData(...) 반환 식을
배치하거나 중괄호로 감싸 return 문을 사용해 포맷 규칙을 준수하도록 수정합니다.
🧹 Nitpick comments (1)
Prezel/core/designsystem/src/main/java/com/team/prezel/core/designsystem/component/snackbar/SnackbarHost.kt (1)

19-25: leadingIcon 파라미터에 기본값 추가를 고려하세요.

leadingIcon 파라미터가 nullable임에도 기본값이 없어서 호출 시 항상 명시적으로 전달해야 합니다. 아이콘 없이 스낵바를 표시하는 경우가 빈번하다면 null 기본값을 추가하는 것이 API 사용성을 높일 수 있습니다.

♻️ 제안된 수정
 suspend fun SnackbarHostState.showPrezelSnackbar(
     message: String,
-    leadingIcon: IconSource?,
+    leadingIcon: IconSource? = null,
     actionLabel: String? = null,
     withDismissAction: Boolean = false,
     duration: SnackbarDuration = SnackbarDuration.Short,
 ) {

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/snackbar/PrezelSnackbar.kt`:
- Around line 192-198: Detekt flags empty function blocks in the preview stub
PreviewSnackbarData; fix it by either annotating the class or the two methods
with `@Suppress`("EmptyFunctionBlock") or by replacing the empty bodies of
performAction() and dismiss() with explicit Unit expressions (e.g.,
performAction(): Unit = Unit) so Detekt no longer reports EmptyFunctionBlock for
PreviewSnackbarData.

*   `PreviewSnackbarData` 클래스에 `@Suppress("EmptyFunctionBlock")` 어노테이션 추가
*   `SnackbarData` 인터페이스의 메서드 구현 순서 변경 (`dismiss` -> `performAction`)
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/snackbar/PrezelSnackbar.kt`:
- Around line 65-69: 현재 코드에서 Surface 및 기타 위치가 PrezelColorScheme.Dark 색상을 하드코딩해
라이트/다크 테마 전환에 영향을 줄 수 있으므로, PrezelSnackbar의 Surface(color = ...) 및 동일한 패턴으로 사용된
모든 색 참조(예: 파일 내 95-113, 124-128 범위)를 PrezelTheme.colors의 적절한 값으로 변경하세요; 예를 들어
PrezelTheme.colors.<appropriateColor>를 사용하도록 바꾸고 PrezelSnackbarDefaults.Shape 같은
식별자는 그대로 유지해 현재 테마의 색을 참조하도록 수정하면 됩니다.

@HamBeomJoon HamBeomJoon requested a review from moondev03 January 29, 2026 14:59
Comment on lines 104 to 115
data.visuals.actionLabel?.let { label ->
Spacer(Modifier.width(PrezelSnackbarDefaults.MessageActionSpacing))

Text(
text = label,
modifier = Modifier
.clickable(role = Role.Button, onClick = { data.performAction() })
.padding(PrezelSnackbarDefaults.ActionTouchPadding),
color = PrezelColorScheme.Dark.interactiveRegular,
style = PrezelTextStyles.Body3Medium.toTextStyle(),
)
}
Copy link
Member

@moondev03 moondev03 Jan 29, 2026

Choose a reason for hiding this comment

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

data.performAction()를 호출하지 않아도
SnackbarResult가 맞게 반환되나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Log찍어본 결과 onClick = { data.performAction() }으로 잘 반환됩니다

shape = PrezelSnackbarDefaults.Shape,
color = PrezelColorScheme.Dark.bgMedium,
) {
PrezelSnackbarContent(
Copy link
Member

Choose a reason for hiding this comment

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

Snackbar(
    ...
    컨테이너 글자 아이콘 등 색상 정의
    ...
    content: @Composable () -> Unit
)

해당 컴포넌트를 사용해서 디자인만 입혀도 될 것 같은데 스낵바 뷰 자체를 구현하신 이유가 궁금해요

지금 보면 기존 스낵바에서 처리해주고 있는 로직들이 모두 포함되고 있지 않아 보여요

디자인 제약 상 위 컴포넌트를 사용하지 못한다면 기존 스낵바에서 처리해주는 로직을 모두 포함하고 있는지 검토 부탁드려요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

기존 Material Snackbar는 레이아웃과 spacing이 강하게 고정되어 있어서 Prezel 디자인 요구사항(leading icon, spacing, touch 영역, minHeight)을 구현하기 힘들다 생각해서 따로 만들었습니다.

기존 스낵바에서 처리해주고 있는 로직

은 다른 리뷰에서말한 action 클릭 결과같은걸 말하는걸까요?

*   `PrezelSnackbar`에서 하드코딩된 스타일 값들을 `PrezelTheme` 시스템(shapes, spacing)을 사용하도록 변경했습니다.
*   `PrezelSnackbarDefaults` 내 불필요한 상수 및 미사용 import를 제거했습니다.
*   `showPrezelSnackbar` 확장 함수에 `onAction`, `onDismiss` 콜백 파라미터를 추가하고 결과 처리를 구현했습니다.
*   `SnackbarVisuals`에서 `leadingIcon`을 추출하는 내부 유틸리티 함수 `leadingIconOrNull()`을 추가했습니다.
*   미리보기 코드에 `PreviewScaffold`를 적용하여 구조를 개선했습니다.
*   `PrezelSnackbar`에서 하드코딩된 스타일 값들을 `PrezelTheme` 시스템(shapes, spacing)을 사용하도록 변경했습니다.
*   `PrezelSnackbarDefaults` 내 불필요한 상수 및 미사용 import를 제거했습니다.
*   `showPrezelSnackbar` 확장 함수에 `onAction`, `onDismiss` 콜백 파라미터를 추가하고 결과 처리를 구현했습니다.
*   `SnackbarVisuals`에서 `leadingIcon`을 추출하는 내부 유틸리티 함수 `leadingIconOrNull()`을 추가했습니다.
*   미리보기 코드에 `PreviewScaffold`를 적용하여 구조를 개선했습니다.
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/snackbar/PrezelSnackbar.kt`:
- Line 65: The external modifier passed into PrezelSnackbar is being forwarded
to the internal Text (seen as modifier = modifier.weight(1f)), which lets caller
padding/size affect the Text; change the Text's modifier to use a fresh local
Modifier (e.g., Modifier.weight(1f)) or combine only safe local modifiers (not
the external parameter) so the external modifier is not applied to the Text —
update the Text invocation inside PrezelSnackbar to use Modifier.weight(1f) (or
Modifier.then(...) with only intended adjustments) instead of
modifier.weight(1f).

- `PrezelSnackbar` 내 액션 버튼의 크기를 `SMALL`로 지정하도록 수정했습니다.
- `leadingIconOrNull` 확장 함수의 위치를 `SnackbarHost.kt`에서 `PrezelSnackbar.kt`로 이동하고 가시성을 `private`으로 변경했습니다.
PrezelSnackbar 컴포넌트 내 Text의 modifier 설정을 매개변수 `modifier` 대신 `Modifier`를 직접 사용하도록 수정했습니다.
PrezelSnackbar의 메시지 Text 컴포넌트에서 `Modifier.weight(1f)` 속성을 제거했습니다.
`PrezelSnackbarVisuals`의 `withDismissAction` 필드에 기본값을 추가하고, 이를 호출하는 `SnackbarHostState.showSnackbar` 함수에서 중복되는 파라미터를 제거했습니다.
@HamBeomJoon HamBeomJoon merged commit 1fcc90f into develop Jan 30, 2026
1 of 2 checks passed
@HamBeomJoon HamBeomJoon deleted the feat/#33-prezel-snackbar branch January 30, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feat 새로운 기능 추가 또는 기존 기능 확장

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PrezelSnackbar 구현

3 participants