Integrated the DateAdapter and the SizeAdapter adapters into the DocumentItem component for the Browse module.
This commit is contained in:
parent
6b1089235a
commit
e982a8f689
@ -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
|
||||
)
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user