-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
GroupsEmptyListView.swift
56 lines (51 loc) · 1.54 KB
/
GroupsEmptyListView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import SwiftUI
import Bonzai
struct GroupsEmptyListView: View {
@Binding private var isVisible: Bool
private let onAction: (GroupsListView.Action) -> Void
private let namespace: Namespace.ID
init(_ namespace: Namespace.ID,
isVisible: Binding<Bool>,
onAction: @escaping (GroupsListView.Action) -> Void) {
_isVisible = isVisible
self.namespace = namespace
self.onAction = onAction
}
var body: some View {
VStack {
if isVisible {
Button(action: {
withAnimation {
onAction(.openScene(.addGroup))
}
}, label: {
HStack(spacing: 8) {
Image(systemName: "plus.circle")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 16, height: 16)
Divider()
.opacity(0.5)
Text("Add Group")
}
.padding(4)
})
.buttonStyle(.zen(.init(color: .systemGreen, hoverEffect: .constant(false))))
.frame(maxHeight: 32)
.matchedGeometryEffect(id: "add-group-button", in: namespace)
}
Text("No groups yet.\nAdd a group to get started.")
.multilineTextAlignment(.center)
.font(.footnote)
}
.padding(.top, 64)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
}
}
struct GroupsEmptyListView_Previews: PreviewProvider {
@Namespace static var namespace
static var previews: some View {
GroupsEmptyListView(namespace, isVisible: .constant(true)) { _ in }
.designTime()
}
}