Reuse card content across macOS and iOS with platform-sized icons and matching card heights. Add the shared Color field below Package and preserve selection, drag, and execution behavior. Migrate stored snippets to V51 and write color in Vault V2 while retaining V1 decoding and guarding against lossy V1 writes. Validation: macOS focused snippet, migration, architecture, and localization tests pass; 30 iOS focused tests pass; Swift format and localization checks pass. Full macOS testing also reports failures in unchanged KeyExport, MCP, and Agent suites.
28 lines
834 B
Swift
28 lines
834 B
Swift
import SwiftUI
|
|
|
|
public struct LibraryCardIcon: View {
|
|
let symbol: String
|
|
let tint: Color
|
|
|
|
public init(symbol: String, tint: Color = .accentColor) {
|
|
self.symbol = symbol
|
|
self.tint = tint
|
|
}
|
|
#if os(macOS)
|
|
private let size: CGFloat = 30
|
|
private let symbolSize: CGFloat = 14
|
|
private let cornerRadius: CGFloat = 6
|
|
#else
|
|
private let size: CGFloat = 36
|
|
private let symbolSize: CGFloat = 17
|
|
private let cornerRadius: CGFloat = 8
|
|
#endif
|
|
|
|
public var body: some View {
|
|
Image(systemName: symbol).font(.system(size: symbolSize, weight: .medium)).foregroundStyle(tint)
|
|
.frame(width: size, height: size)
|
|
.background(tint.opacity(0.16), in: .rect(cornerRadius: cornerRadius))
|
|
.accessibilityHidden(true)
|
|
}
|
|
}
|