Ariver
2026-05-06 5864f862bc769f3ba4554a744ea5eceb61c2a64c
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
41
42
43
import SwiftUI
import AppKit
 
// MARK: - App Grid Item (icon + name card, with Dock-like hover)
 
struct AppGridItem: View {
    let app: AppInfo
    let iconSize: CGFloat
    let onSelect: () -> Void
 
    @State private var isHovered = false
 
    var body: some View {
        Button(action: onSelect) {
            VStack(spacing: 6) {
                Image(nsImage: app.icon)
                    .resizable()
                    .aspectRatio(contentMode: .fit)
                    .frame(width: iconSize, height: iconSize)
                    .scaleEffect(isHovered ? 1.22 : 1.0)
                    .shadow(
                        color: .black.opacity(isHovered ? 0.35 : 0),
                        radius: isHovered ? 14 : 0,
                        y: isHovered ? 8 : 0
                    )
                    .animation(.spring(response: 0.3, dampingFraction: 0.7), value: isHovered)
 
                Text(app.name)
                    .font(.system(size: 11, weight: .medium))
                    .lineLimit(1)
                    .truncationMode(.tail)
                    .frame(maxWidth: iconSize + 20)
            }
            .padding(.vertical, 8)
            .padding(.horizontal, 4)
            .contentShape(RoundedRectangle(cornerRadius: 10))
        }
        .buttonStyle(.plain)
        .onHover { hovering in
            isHovered = hovering
        }
    }
}