diff --git a/czan/build.gradle.kts b/czan/build.gradle.kts index acb8eca..359d3cc 100644 --- a/czan/build.gradle.kts +++ b/czan/build.gradle.kts @@ -53,7 +53,6 @@ kotlin { androidTarget { publishLibraryVariants("release") - @OptIn(ExperimentalKotlinGradlePluginApi::class) compilerOptions { jvmTarget.set(JvmTarget.fromTarget(ProjectConfiguration.Compiler.jvmTarget)) @@ -72,7 +71,6 @@ kotlin { } sourceSets { - commonMain.dependencies { implementation(project.dependencies.platform(libs.tweener.bom)) implementation(libs.tweener.common) diff --git a/czan/src/commonMain/kotlin/com/tweener/czan/designsystem/molecule/tabs/Tabs.kt b/czan/src/commonMain/kotlin/com/tweener/czan/designsystem/molecule/tabs/Tabs.kt index 69c40b3..40df07e 100644 --- a/czan/src/commonMain/kotlin/com/tweener/czan/designsystem/molecule/tabs/Tabs.kt +++ b/czan/src/commonMain/kotlin/com/tweener/czan/designsystem/molecule/tabs/Tabs.kt @@ -46,6 +46,7 @@ import org.jetbrains.compose.resources.DrawableResource import org.jetbrains.compose.resources.StringResource class TabItem( + val id: String, val title: StringResource, val icon: DrawableResource? = null, ) @@ -54,13 +55,13 @@ class TabItem( @Composable fun PrimaryTabs( tabItems: List, - tabsContents: List<@Composable () -> Unit>, modifier: Modifier = Modifier, colors: TabsColors = TabsDefaults.colors(), textStyle: TextStyle = MaterialTheme.typography.bodyMedium, shape: Shape = RoundedCornerShape(Size.Padding.Small), contentPadding: PaddingValues = TabsDefaults.ContentPadding, showDivider: Boolean = false, + onTabChanged: (@Composable (String) -> Unit)? = null, ) { var selectedTabIndex by remember { mutableIntStateOf(0) } @@ -92,7 +93,7 @@ fun PrimaryTabs( } } - tabsContents.getOrNull(selectedTabIndex)?.invoke() + onTabChanged?.invoke(tabItems[selectedTabIndex].id) } } @@ -100,13 +101,13 @@ fun PrimaryTabs( @Composable fun SecondaryTabs( tabItems: List, - tabsContents: List<@Composable () -> Unit>, modifier: Modifier = Modifier, colors: TabsColors = TabsDefaults.colors(), textStyle: TextStyle = MaterialTheme.typography.bodyMedium, shape: Shape = RoundedCornerShape(Size.Padding.Small), contentPadding: PaddingValues = TabsDefaults.ContentPadding, showDivider: Boolean = false, + onTabChanged: (@Composable (String) -> Unit)? = null, ) { var selectedTabIndex by remember { mutableIntStateOf(0) } @@ -138,7 +139,7 @@ fun SecondaryTabs( } } - tabsContents.getOrNull(selectedTabIndex)?.invoke() + onTabChanged?.invoke(tabItems[selectedTabIndex].id) } }