39 lines
1.3 KiB
Swift
39 lines
1.3 KiB
Swift
|
|
import SwiftUI
|
||
|
|
|
||
|
|
struct FolderRow: View {
|
||
|
|
let item: NASItem
|
||
|
|
let isSelected: Bool
|
||
|
|
let onTap: () -> Void
|
||
|
|
|
||
|
|
var body: some View {
|
||
|
|
Button(action: onTap) {
|
||
|
|
HStack(spacing: 12) {
|
||
|
|
Image(systemName: item.isDirectory ? "folder.fill" : "doc.fill")
|
||
|
|
.font(.system(size: 18))
|
||
|
|
.foregroundColor(isSelected ? .white : (item.isDirectory ? AppTheme.blue : AppTheme.textSecondary))
|
||
|
|
|
||
|
|
Text(item.name)
|
||
|
|
.font(AppTheme.bodyFont)
|
||
|
|
.fontWeight(isSelected ? .semibold : .regular)
|
||
|
|
.foregroundColor(isSelected ? .white : AppTheme.textPrimary)
|
||
|
|
|
||
|
|
Spacer()
|
||
|
|
|
||
|
|
if isSelected {
|
||
|
|
Image(systemName: "checkmark")
|
||
|
|
.font(.system(size: 13, weight: .bold))
|
||
|
|
.foregroundColor(.white)
|
||
|
|
} else if item.isDirectory {
|
||
|
|
Image(systemName: "chevron.right")
|
||
|
|
.font(.system(size: 13, weight: .medium))
|
||
|
|
.foregroundColor(AppTheme.textTertiary)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
.padding(.horizontal, 16)
|
||
|
|
.padding(.vertical, 12)
|
||
|
|
.background(isSelected ? AppTheme.blue : Color.clear)
|
||
|
|
}
|
||
|
|
.buttonStyle(.plain)
|
||
|
|
}
|
||
|
|
}
|