Skip to content

Commit

Permalink
Remove some warnings (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzxdtc committed Sep 21, 2023
1 parent 696e2b7 commit 8d9e120
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private class ComposableBackHandler(enabled: Boolean) : OnBackPressedCallback(en
}

@Composable
internal fun handler(
internal fun Handler(
enabled: Boolean = true,
onBackPressed: () -> Unit
) {
Expand Down Expand Up @@ -65,7 +65,7 @@ internal fun BackButtonHandler(
CompositionLocalProvider(
LocalBackPressedDispatcher provides context as ComponentActivity
) {
handler {
Handler {
onBackPressed()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.material.Card
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -62,8 +61,8 @@ internal fun ComponentCard(
) {
val composableModifier = Modifier.generateComposableModifier(metadata)
val composableContainerModifier = Modifier.generateContainerModifier(onClick)
Card() {
Box() {
Card {
Box {
Column(modifier = composableModifier) {
metadata.component()
}
Expand All @@ -76,13 +75,15 @@ internal fun ComponentCard(
modifier = Modifier
.matchParentSize()
.then(composableContainerModifier)
){}
) {}
}

}
}

private fun Modifier.generateContainerModifier(onClick: (() -> Unit)?) = composed { onClick?.let {
fillMaxWidth()
.clickable(onClick = onClick)
} ?: fillMaxWidth() }
private fun Modifier.generateContainerModifier(onClick: (() -> Unit)?) =
onClick?.let {
fillMaxWidth()
.clickable(onClick = onClick)
} ?: fillMaxWidth()

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.airbnb.android.showkase.models.ShowkaseBrowserScreenMetadata
import com.airbnb.android.showkase.models.ShowkaseCurrentScreen
import com.airbnb.android.showkase.models.clear
import com.airbnb.android.showkase.models.clearActiveSearch
import java.util.Locale

@Composable
internal fun ShowkaseColorsInAGroupScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ internal fun ShowkaseComponentDetailScreen(
ShowkaseComponentCardType.values().forEach { showkaseComponentCardType ->
when (showkaseComponentCardType) {
ShowkaseComponentCardType.BASIC -> {
if (!metadata.componentKDoc.isBlank()) {
if (metadata.componentKDoc.isNotBlank()) {
DocumentationPanel(metadata.componentKDoc)
}
BasicComponentCard(metadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.airbnb.android.showkase.models.ShowkaseCurrentScreen
import com.airbnb.android.showkase.models.clear
import com.airbnb.android.showkase.models.clearActiveSearch
import com.airbnb.android.showkase.models.update
import java.util.Locale

@Composable
internal fun ShowkaseComponentsInAGroupScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Snackbar
import androidx.compose.ui.unit.dp

@Composable
internal fun ShowkaseErrorScreen(errorText: String) {
Expand Down

0 comments on commit 8d9e120

Please sign in to comment.