Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #508 from razeware/filter-enhancement
Browse files Browse the repository at this point in the history
Change the filter view per Luke's design
  • Loading branch information
0xTim authored Nov 2, 2020
2 parents c5d904f + 893a4a3 commit 0cd59ec
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Emitron/Emitron/UI/Library/Filtering/FiltersHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ struct FiltersHeaderView: View {
isExpanded.toggle()
}) {
HStack {
Text(filterGroup.type.name)
Text("\(filterGroup.type.name)\(filterCount)")
.foregroundColor(.titleText)
.font(.uiLabelBold)

Spacer()
Text(isExpanded ? "Hide (\(numOfOnFilters))" : "Show (\(numOfOnFilters))")

Image(systemName: isExpanded ? "chevron.up" : "chevron.down")
.foregroundColor(.contentText)
.font(.uiLabelBold)
}
Expand All @@ -72,11 +72,18 @@ struct FiltersHeaderView: View {
}
}
}


private var filterCount: String {
if numOfOnFilters > 0 {
return "\(numOfOnFilters)"
}
return ""
}

private var numOfOnFilters: Int {
filterGroup.filters.filter(\.isOn).count
}

private var expandedView: some View {
VStack(alignment: .leading, spacing: 8) {
ForEach(Array(filterGroup.filters), id: \.self) { filter in
Expand Down

0 comments on commit 0cd59ec

Please sign in to comment.