Integrated the DateAdapter and the SizeAdapter adapters into the DocumentItem component for the Browse module.

This commit is contained in:
Javier Cicchelli 2022-12-16 00:10:42 +01:00
parent 6b1089235a
commit e982a8f689
2 changed files with 6 additions and 3 deletions

View File

@ -19,7 +19,7 @@ struct SizeAdapter {
func callAsFunction(value: Int?) -> String {
guard let value else { return .Constants.noValue }
var sizeInBytes = Measurement(
let sizeInBytes = Measurement(
value: Double(value),
unit: UnitInformationStorage.bytes
)

View File

@ -18,6 +18,9 @@ struct DocumentItem: View {
let download: ActionClosure
let delete: ActionClosure
private let dateAdapter = DateAdapter()
private let sizeAdapter = SizeAdapter()
// MARK: Body
var body: some View {
@ -34,11 +37,11 @@ struct DocumentItem: View {
.itemName()
HStack {
Text("lastModified")
Text(dateAdapter(value: document?.lastModifiedAt))
Spacer()
Text("fileSize")
Text(sizeAdapter(value: document?.size))
}
.font(.subheadline)
.foregroundColor(.secondary)