Skip to content

Commit 33e5b72

Browse files
committed
Introduce KdCard component and restrict direct usage of androidx.compose.material3.Card
1 parent 34b96f5 commit 33e5b72

File tree

2 files changed

+31
-0
lines changed
  • composeApp/src/desktopTest/kotlin/com/developersbreach/kotlindictionarymultiplatform
  • design-system/src/commonMain/kotlin/com/developersbreach/designsystem/components

2 files changed

+31
-0
lines changed

composeApp/src/desktopTest/kotlin/com/developersbreach/kotlindictionarymultiplatform/DesignSystemTest.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ class DesignSystemTest {
9494
)
9595
}
9696

97+
@Test
98+
fun `no direct usage of androidx compose card should be allowed except designSystem`() {
99+
checkNoDirectUsageExceptAllowed(
100+
componentName = "androidx.compose.material3.Card",
101+
excludePaths = arrayOf("$DESIGN_SYSTEM_PATH/Card.kt"),
102+
)
103+
}
104+
97105
companion object {
98106
private const val DESIGN_SYSTEM_PATH =
99107
"design-system/src/commonMain/kotlin/com/developersbreach/designsystem/components"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.developersbreach.designsystem.components
2+
3+
import androidx.compose.foundation.layout.ColumnScope
4+
import androidx.compose.material3.Card
5+
import androidx.compose.material3.CardColors
6+
import androidx.compose.material3.CardElevation
7+
import androidx.compose.runtime.Composable
8+
import androidx.compose.ui.Modifier
9+
10+
@Composable
11+
fun KdCard(
12+
modifier: Modifier,
13+
colors: CardColors,
14+
elevation: CardElevation,
15+
content: @Composable ColumnScope.() -> Unit,
16+
) {
17+
Card(
18+
modifier = modifier,
19+
content = content,
20+
elevation = elevation,
21+
colors = colors,
22+
)
23+
}

0 commit comments

Comments
 (0)