@using WebSharpRSS.Models @using CodeHollow.FeedReader
@HeaderText @foreach (CategoryGuideItem catItem in Categories) {
@catItem.CategoryTitle
@* Feeds *@ @if (catItem.IsExpanded && catItem.FeedItems != null) { foreach (FeedGuideItem feedItem in catItem.FeedItems) {
@feedItem.Feed.Title
} }
}
@code { [Parameter] public string HeaderText { get; set; } [Parameter] public HashSet Categories { get; set; } = new HashSet(); [Parameter] public Action? CatItemClicked { get; set; } [Parameter] public Action? FeedItemClicked { get; set; } ISelectableGuideItem? _selectedCategory; void ItemClicked(ISelectableGuideItem categoryItem) { categoryItem.IsExpanded = !categoryItem.IsExpanded; if (_selectedCategory != categoryItem) { if (_selectedCategory != null) _selectedCategory.IsSelected = false; _selectedCategory = categoryItem; _selectedCategory.IsSelected = true; } switch (categoryItem) { case CategoryGuideItem catGuideItem: CatItemClicked?.Invoke(catGuideItem); break; case FeedGuideItem feedGuideItem: FeedItemClicked?.Invoke(feedGuideItem); break; } } }