72 lines
1.6 KiB
Swift

//
// DocumentItem.swift
// Browse
//
// Created by Javier Cicchelli on 03/12/2022.
// Copyright © 2022 Röck+Cöde. All rights reserved.
//
import SwiftUI
struct DocumentItem: View {
// MARK: Properties
let name: String
let lastModified: String
let fileSize: String
// MARK: Body
var body: some View {
HStack(spacing: 16) {
Image.document
.icon(size: 32)
.foregroundColor(.red)
VStack {
Text(name)
.itemName()
HStack {
Text(lastModified)
Spacer()
Text(fileSize)
}
.font(.subheadline)
.foregroundColor(.secondary)
}
}
.padding(16)
}
}
// MARK: - Image+Constants
private extension Image {
static let document = Image(systemName: "doc.fill")
}
// MARK: - Previews
struct DocumentItem_Previews: PreviewProvider {
static var previews: some View {
DocumentItem(
name: "Some document name goes in here...",
lastModified: "Some few hours ago",
fileSize: "23,5 Mbytes"
)
.previewDisplayName("Document item")
DocumentItem(
name: "Some very, extremely long document name goes in here...",
lastModified: "Yesterday",
fileSize: "235,6 Kbytes"
)
.previewDisplayName("Document item with long name")
}
}