Skip to content

Commit bb2df81

Browse files
committed
Refactor unread statuses button styling and label
Moved the label view into a separate computed property for reuse. Updated button styling to use glassEffect on iOS 26 and above, and added foregroundStyle(.white) for improved appearance. Removed redundant .buttonStyle(.glass) and adjusted padding.
1 parent 9954a0b commit bb2df81

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

Packages/Timeline/Sources/Timeline/TimelineUnreadStatusesObserver.swift

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ struct TimelineUnreadStatusesView: View {
4444
#if os(visionOS)
4545
.buttonStyle(.bordered)
4646
.tint(Material.ultraThick)
47-
#else
48-
.buttonStyle(.glass)
4947
#endif
5048
.padding(8)
49+
.foregroundStyle(.white)
5150
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: preferences.pendingLocation)
5251
} else {
5352
buttonBody
@@ -77,18 +76,13 @@ struct TimelineUnreadStatusesView: View {
7776
Button {
7877
onButtonTap(observer.pendingStatuses.last)
7978
} label: {
80-
HStack(spacing: 8) {
81-
if observer.isLoadingNewStatuses {
82-
ProgressView()
83-
}
84-
if observer.pendingStatusesCount > 0 {
85-
Text("\(observer.pendingStatusesCount)")
86-
.contentTransition(.numericText(value: Double(observer.pendingStatusesCount)))
87-
// Accessibility: this results in a frame with a size of at least 44x44 at regular font size
88-
.frame(minWidth: 16, minHeight: 16)
89-
.font(.footnote.monospacedDigit())
90-
.fontWeight(.bold)
91-
}
79+
if #available(iOS 26, *) {
80+
label
81+
.padding(.horizontal, 12)
82+
.padding(.vertical, 8)
83+
.glassEffect(.regular.tint(theme.tintColor.opacity(0.4)).interactive(), in: .capsule)
84+
} else {
85+
label
9286
}
9387
}
9488
.accessibilityLabel(
@@ -97,4 +91,19 @@ struct TimelineUnreadStatusesView: View {
9791
.accessibilityHint("accessibility.tabs.timeline.unread-posts.hint")
9892
}
9993
}
94+
95+
var label: some View {
96+
HStack(spacing: 8) {
97+
if observer.isLoadingNewStatuses {
98+
ProgressView()
99+
}
100+
if observer.pendingStatusesCount > 0 {
101+
Text("\(observer.pendingStatusesCount)")
102+
.contentTransition(.numericText(value: Double(observer.pendingStatusesCount)))
103+
.frame(minWidth: 16, minHeight: 16)
104+
.font(.footnote.monospacedDigit())
105+
.fontWeight(.bold)
106+
}
107+
}
108+
}
100109
}

0 commit comments

Comments
 (0)