@OptIn(ExperimentalComposeUiApi::class) @Suppress("LongParameterList") @Composable fun PocketStoriesCategories( categories: List<PocketRecommendedStoriesCategory>, selections: List<PocketRecommendedStoriesSelectedCategory>, modifier: Modifier = Modifier, categoryColors: PocketStoriesCategoryColors = PocketStoriesCategoryColors.buildColors(), onCategoryClick: (PocketRecommendedStoriesCategory) -> Unit, ) { Box( modifier = modifier.semantics { testTagsAsResourceId = true testTag = "pocket.categories" }, ) { StaggeredHorizontalGrid( horizontalItemsSpacing = 16.dp, verticalItemsSpacing = 16.dp, ) { categories.filter { it.name != POCKET_STORIES_DEFAULT_CATEGORY_NAME }.forEach { category -> SelectableChip( text = category.name, isSelected = selections.map { it.name }.contains(category.name), selectedTextColor = categoryColors.selectedTextColor, unselectedTextColor = categoryColors.unselectedTextColor, selectedBackgroundColor = categoryColors.selectedBackgroundColor, unselectedBackgroundColor = categoryColors.unselectedBackgroundColor, ) { onCategoryClick(category) } } } } }
Displays a list of [PocketRecommendedStoriesCategory]s.