Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created September 11, 2024 02:44
Show Gist options
  • Save skydoves/4c088ddd077d1dc3c3d5bcac5f3e4395 to your computer and use it in GitHub Desktop.
Save skydoves/4c088ddd077d1dc3c3d5bcac5f3e4395 to your computer and use it in GitHub Desktop.
timeline_content_version
@Composable
private fun TimelineContent(
timelineViewModel: TimelineViewModel = hiltViewModel(),
navigateToDetails: (UiComponent, Int) -> Unit
) {
val timelineUi by timelineViewModel.timelineUi.collectAsStateWithLifecycle()
Column(
modifier = Modifier
.background(ServerDrivenTheme.colors.background)
.fillMaxSize()
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
timelineUi.components.forEach { uiComponent ->
uiComponent.Consume(
version = timelineUi.uiVersion,
navigator = { clickedComponent ->
navigateToDetails.invoke(clickedComponent, timelineUi.version)
}
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment