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 {
|
func callAsFunction(value: Int?) -> String {
|
||||||
guard let value else { return .Constants.noValue }
|
guard let value else { return .Constants.noValue }
|
||||||
|
|
||||||
var sizeInBytes = Measurement(
|
let sizeInBytes = Measurement(
|
||||||
value: Double(value),
|
value: Double(value),
|
||||||
unit: UnitInformationStorage.bytes
|
unit: UnitInformationStorage.bytes
|
||||||
)
|
)
|
||||||
|
@ -18,6 +18,9 @@ struct DocumentItem: View {
|
|||||||
let download: ActionClosure
|
let download: ActionClosure
|
||||||
let delete: ActionClosure
|
let delete: ActionClosure
|
||||||
|
|
||||||
|
private let dateAdapter = DateAdapter()
|
||||||
|
private let sizeAdapter = SizeAdapter()
|
||||||
|
|
||||||
// MARK: Body
|
// MARK: Body
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -34,11 +37,11 @@ struct DocumentItem: View {
|
|||||||
.itemName()
|
.itemName()
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Text("lastModified")
|
Text(dateAdapter(value: document?.lastModifiedAt))
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Text("fileSize")
|
Text(sizeAdapter(value: document?.size))
|
||||||
}
|
}
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user