Add icons for all filters

This commit is contained in:
Thomas Ricouard 2023-12-30 16:16:19 +01:00
parent 781121d1d4
commit 0497191acf
3 changed files with 9 additions and 7 deletions

View file

@ -189,7 +189,7 @@ struct TimelineTab: View {
Button {
timeline = .latest
} label: {
Label(TimelineFilter.latest.localizedTitle(), systemImage: TimelineFilter.latest.iconName() ?? "")
Label(TimelineFilter.latest.localizedTitle(), systemImage: TimelineFilter.latest.iconName())
}
if timeline == .home {
Button {
@ -197,7 +197,7 @@ struct TimelineTab: View {
} label: {
VStack {
Label(TimelineFilter.resume.localizedTitle(),
systemImage: TimelineFilter.resume.iconName() ?? "")
systemImage: TimelineFilter.resume.iconName())
}
}
}
@ -232,7 +232,7 @@ struct TimelineTab: View {
Button {
self.timeline = timeline
} label: {
Label(timeline.localizedTitle(), systemImage: timeline.iconName() ?? "")
Label(timeline.localizedTitle(), systemImage: timeline.iconName())
}
}
}

View file

@ -115,7 +115,7 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
}
}
public func iconName() -> String? {
public func iconName() -> String {
switch self {
case .latest:
"arrow.counterclockwise"
@ -133,8 +133,10 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
"list.bullet"
case .remoteLocal:
"dot.radiowaves.right"
default:
nil
case .tagGroup:
"tag"
case .hashtag:
"number"
}
}

View file

@ -42,7 +42,7 @@ struct TimelineQuickAccessPills: View {
Button {
timeline = filter
} label: {
Label(filter.localizedTitle(), systemImage: filter.iconName() ?? "")
Label(filter.localizedTitle(), systemImage: filter.iconName())
.font(.callout)
}
.transition(.push(from: .leading).combined(with: .opacity))