mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 05:19:13 +00:00
moved from a list to a custom view for the symbol picker it looks beautiful imo
- animations!! symbol preview doesnt have a glow if its "small" added a blur on connectionview if the symbol picker popover is visible - need to figure out how to animate it dipping
This commit is contained in:
@@ -77,6 +77,7 @@ struct ConnectionView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.blur(radius: showIconPicker ? 5 : 0)
|
||||
.scrollContentBackground(.hidden)
|
||||
.transition(.opacity)
|
||||
.onDisappear {
|
||||
@@ -114,14 +115,14 @@ Hostkey fingerprint is \(handler.getHostkey() ?? "nil")
|
||||
.toolbar {
|
||||
ToolbarItem {
|
||||
Button() {
|
||||
showIconPicker.toggle()
|
||||
withAnimation { showIconPicker.toggle() }
|
||||
} label: {
|
||||
HostSymbolPreview(symbol: handler.host.symbol, label: handler.host.label, small: true)
|
||||
.id(handler.host)
|
||||
}
|
||||
.popover(isPresented: $showIconPicker) {
|
||||
HostSymbolPicker(host: $handler.host)
|
||||
.frame(minWidth: 300, minHeight: 200)
|
||||
.frame(minWidth: 275, minHeight: 125)
|
||||
.modifier(presentationCompactPopover())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,19 +10,27 @@ import SwiftUI
|
||||
struct HostSymbolPicker: View {
|
||||
@Binding var host: Host
|
||||
|
||||
@Environment(\.colorScheme) var cScheme
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.foregroundStyle(cScheme == .dark ? .black : .gray)
|
||||
VStack(alignment: .center, spacing: 10) {
|
||||
ScrollView(.horizontal) {
|
||||
HStack {
|
||||
ForEach(HostSymbol.allCases, id: \.self) { symbol in
|
||||
ZStack {
|
||||
if host.symbol == symbol {
|
||||
RoundedRectangle(cornerRadius: 10)
|
||||
Rectangle()
|
||||
.fill(.gray.opacity(0.5))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 5))
|
||||
}
|
||||
HostSymbolPreview(symbol: symbol, label: host.label)
|
||||
.padding(5)
|
||||
.padding(10)
|
||||
}
|
||||
.transition(.opacity)
|
||||
.animation(.bouncy, value: host.symbol)
|
||||
.frame(width: 50, height: 50)
|
||||
.onTapGesture {
|
||||
withAnimation { host.symbol = symbol }
|
||||
@@ -30,8 +38,15 @@ struct HostSymbolPicker: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
TextBox(label: "Icon Text", text: $host.label, prompt: "")
|
||||
.scrollIndicators(.visible)
|
||||
|
||||
Divider()
|
||||
|
||||
TextBox(label: host.label.isEmpty ? "" : "Icon Label", text: $host.label, prompt: "Icon label")
|
||||
}
|
||||
.padding(10)
|
||||
}
|
||||
.scrollDisabled(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,15 +17,9 @@ struct HostSymbolPreview: View {
|
||||
HStack(alignment: .center, spacing: 5) {
|
||||
Text(label)
|
||||
.font(.headline)
|
||||
ZStack(alignment: .center) {
|
||||
symbol.image
|
||||
.resizable().scaledToFit()
|
||||
.symbolRenderingMode(.monochrome)
|
||||
.blur(radius: 1)
|
||||
symbol.image
|
||||
.resizable().scaledToFit()
|
||||
.symbolRenderingMode(.monochrome)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ZStack(alignment: .center) {
|
||||
|
||||
Reference in New Issue
Block a user