blob: 93aea1504adb9e822d2f117e6b7e46e3bf610998 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import SwiftUI
struct TrackerBookmarkServerView: View {
let server: BookmarkServer
var body: some View {
HStack(alignment: .center, spacing: 6) {
Image("Server")
.resizable()
.scaledToFit()
.frame(width: 16, height: 16, alignment: .center)
Text(self.server.name ?? "Server").lineLimit(1).truncationMode(.tail)
if let serverDescription = self.server.description {
Text(serverDescription)
.foregroundStyle(.secondary)
.lineLimit(1)
.truncationMode(.tail)
}
Spacer(minLength: 0)
if self.server.users > 0 {
Text(String(self.server.users))
.foregroundStyle(.secondary)
.lineLimit(1)
Circle()
.fill(.fileComplete)
.frame(width: 7, height: 7)
.keyframeAnimator(initialValue: 1.0, repeating: true) { content, opacity in
content.opacity(opacity)
} keyframes: { _ in
CubicKeyframe(1.0, duration: 2.0) // Stay visible for 1 second
CubicKeyframe(0.6, duration: 0.5) // Fade out quickly
CubicKeyframe(1.0, duration: 0.5) // Fade in quickly
}
.padding(.trailing, 6)
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
|