Skip to content

Commit a9bd3cc

Browse files
committed
refactor: dismissable parameter
1 parent d233497 commit a9bd3cc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/src/main/java/to/bitkit/ui/components/SuggestionCard.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ fun SuggestionCard(
6363
duration: Duration? = null,
6464
size: Int = 152,
6565
captionColor: Color = Colors.White64,
66-
dismissable: Boolean = true,
6766
onClick: () -> Unit,
6867
) {
68+
val dismissable = onClose != null
69+
6970
LaunchedEffect(Unit) {
7071
duration?.let {
7172
delay(it)
@@ -137,7 +138,7 @@ fun SuggestionCard(
137138
modifier = Modifier.weight(1f)
138139
)
139140

140-
if (duration == null && onClose != null && dismissable) {
141+
if (duration == null && onClose != null) {
141142
IconButton(
142143
onClick = onClose,
143144
modifier = Modifier
@@ -281,7 +282,6 @@ private fun Preview() {
281282
icon = item.icon,
282283
onClose = {},
283284
onClick = {},
284-
dismissable = item != Suggestion.LIGHTNING_READY,
285285
duration = 5.seconds.takeIf { item == Suggestion.LIGHTNING_READY }
286286
)
287287
}

0 commit comments

Comments
 (0)