forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTabView.swift
More file actions
49 lines (44 loc) · 1.43 KB
/
TabView.swift
File metadata and controls
49 lines (44 loc) · 1.43 KB
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
import ComposableArchitecture
import SwiftUI
struct TabView: View {
let store: StoreOf<ChatPanelFeature>
struct State: Equatable {
var chatPanelInASeparateWindow: Bool
var colorScheme: ColorScheme
}
var body: some View {
WithViewStore(
store,
observe: {
State(
chatPanelInASeparateWindow: $0.chatPanelInASeparateWindow,
colorScheme: $0.colorScheme
)
}
) { viewStore in
Button(action: {
viewStore.send(.toggleChatPanelDetachedButtonClicked)
}, label: {
Image(systemName: "ellipsis.bubble.fill")
.frame(width: Style.widgetWidth, height: Style.widgetHeight)
.background(
Color.userChatContentBackground,
in: Circle()
)
})
.buttonStyle(.plain)
.opacity(viewStore.chatPanelInASeparateWindow ? 1 : 0)
.preferredColorScheme(viewStore.colorScheme)
.frame(maxWidth: Style.widgetWidth, maxHeight: Style.widgetHeight)
}
}
}
struct TabView_Preview: PreviewProvider {
static var previews: some View {
VStack {
TabView(store: .init(initialState: .init(), reducer: ChatPanelFeature()))
}
.frame(width: 30)
.background(Color.black)
}
}