Removed the ItemIdClosure definition from the Browse module as it is not needed anymore.
This commit is contained in:
parent
0ecc4810fa
commit
fc9f650a08
@ -1,9 +0,0 @@
|
|||||||
//
|
|
||||||
// Typealiases.swift
|
|
||||||
// Browse
|
|
||||||
//
|
|
||||||
// Created by Javier Cicchelli on 14/12/2022.
|
|
||||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
typealias ItemIdClosure = (String) -> Void
|
|
@ -6,6 +6,7 @@
|
|||||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import DataModels
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct DocumentItem: View {
|
struct DocumentItem: View {
|
||||||
@ -13,15 +14,15 @@ struct DocumentItem: View {
|
|||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
let item: FileSystemItem
|
let item: FileSystemItem
|
||||||
let select: ItemIdClosure
|
let select: ActionClosure
|
||||||
let download: ItemIdClosure
|
let download: ActionClosure
|
||||||
let delete: ItemIdClosure
|
let delete: ActionClosure
|
||||||
|
|
||||||
// MARK: Body
|
// MARK: Body
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button {
|
Button {
|
||||||
select(item.id)
|
select()
|
||||||
} label: {
|
} label: {
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
Image.document
|
Image.document
|
||||||
@ -50,7 +51,7 @@ struct DocumentItem: View {
|
|||||||
allowsFullSwipe: true
|
allowsFullSwipe: true
|
||||||
) {
|
) {
|
||||||
Button {
|
Button {
|
||||||
delete(item.id)
|
delete()
|
||||||
} label: {
|
} label: {
|
||||||
Label {
|
Label {
|
||||||
Text(
|
Text(
|
||||||
@ -64,7 +65,7 @@ struct DocumentItem: View {
|
|||||||
.tint(.red)
|
.tint(.red)
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
download(item.id)
|
download()
|
||||||
} label: {
|
} label: {
|
||||||
Label {
|
Label {
|
||||||
Text(
|
Text(
|
||||||
@ -103,12 +104,12 @@ struct DocumentItem_Previews: PreviewProvider {
|
|||||||
contentType: "some content type",
|
contentType: "some content type",
|
||||||
size: .random(in: 1 ... 100),
|
size: .random(in: 1 ... 100),
|
||||||
lastModifiedAt: .now
|
lastModifiedAt: .now
|
||||||
)) { _ in
|
)) {
|
||||||
// select closure with item id.
|
// select closure.
|
||||||
} download: { _ in
|
} download: {
|
||||||
// download closure with item id.
|
// download closure.
|
||||||
} delete: { _ in
|
} delete: {
|
||||||
// delete closure with item id.
|
// delete closure.
|
||||||
}
|
}
|
||||||
.previewDisplayName("Document item")
|
.previewDisplayName("Document item")
|
||||||
|
|
||||||
@ -118,12 +119,12 @@ struct DocumentItem_Previews: PreviewProvider {
|
|||||||
contentType: "some content type",
|
contentType: "some content type",
|
||||||
size: .random(in: 1 ... 100),
|
size: .random(in: 1 ... 100),
|
||||||
lastModifiedAt: .now
|
lastModifiedAt: .now
|
||||||
)) { _ in
|
)) {
|
||||||
// select closure with item id.
|
// select closure.
|
||||||
} download: { _ in
|
} download: {
|
||||||
// download closure with item id.
|
// download closure.
|
||||||
} delete: { _ in
|
} delete: {
|
||||||
// delete closure with item id.
|
// delete closure.
|
||||||
}
|
}
|
||||||
.previewDisplayName("Document item with long name")
|
.previewDisplayName("Document item with long name")
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import DataModels
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct FolderItem: View {
|
struct FolderItem: View {
|
||||||
@ -13,14 +14,14 @@ struct FolderItem: View {
|
|||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
let item: FileSystemItem
|
let item: FileSystemItem
|
||||||
let select: ItemIdClosure
|
let select: ActionClosure
|
||||||
let delete: ItemIdClosure
|
let delete: ActionClosure
|
||||||
|
|
||||||
// MARK: Body
|
// MARK: Body
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Button {
|
Button {
|
||||||
select(item.id)
|
select()
|
||||||
} label: {
|
} label: {
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
Image.folder
|
Image.folder
|
||||||
@ -42,7 +43,7 @@ struct FolderItem: View {
|
|||||||
allowsFullSwipe: true
|
allowsFullSwipe: true
|
||||||
) {
|
) {
|
||||||
Button {
|
Button {
|
||||||
delete(item.id)
|
delete()
|
||||||
} label: {
|
} label: {
|
||||||
Label {
|
Label {
|
||||||
Text(
|
Text(
|
||||||
@ -73,20 +74,20 @@ struct BrowseItem_Previews: PreviewProvider {
|
|||||||
FolderItem(item: Folder(
|
FolderItem(item: Folder(
|
||||||
id: "1234567890",
|
id: "1234567890",
|
||||||
name: "Some folder name goes in here..."
|
name: "Some folder name goes in here..."
|
||||||
)) { _ in
|
)) {
|
||||||
// select closure with item id.
|
// select closure.
|
||||||
} delete: { _ in
|
} delete: {
|
||||||
// delete closure with item id.
|
// delete closure.
|
||||||
}
|
}
|
||||||
.previewDisplayName("Folder item")
|
.previewDisplayName("Folder item")
|
||||||
|
|
||||||
FolderItem(item: Folder(
|
FolderItem(item: Folder(
|
||||||
id: "1234567890",
|
id: "1234567890",
|
||||||
name: "Some very, extremely long folder name goes in here..."
|
name: "Some very, extremely long folder name goes in here..."
|
||||||
)) { _ in
|
)) {
|
||||||
// select closure with item id.
|
// select closure.
|
||||||
} delete: { _ in
|
} delete: {
|
||||||
// delete closure with item id.
|
// delete closure.
|
||||||
}
|
}
|
||||||
.previewDisplayName("Folder item with long name")
|
.previewDisplayName("Folder item with long name")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user